From d00a8920c41fa5b99830095ca259e341ad31236a Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Wed, 4 Sep 2024 19:19:10 +0000 Subject: [PATCH 1/3] Remove delegate call from public --- avm-transpiler/src/opcodes.rs | 2 - .../vm/avm/trace/deserialization.cpp | 1 - .../barretenberg/vm/avm/trace/fixed_gas.cpp | 3 +- .../src/barretenberg/vm/avm/trace/opcode.cpp | 2 - .../src/barretenberg/vm/avm/trace/opcode.hpp | 1 - .../src/barretenberg/vm/aztec_constants.hpp | 2 - .../protocol-specs/calls/delegate-calls.md | 2 +- .../public-vm/_nested-context.md | 8 +- .../protocol-specs/public-vm/avm-circuit.md | 1 - .../docs/protocol-specs/public-vm/context.mdx | 2 - .../protocol-specs/public-vm/execution.md | 8 +- .../public-vm/gen/_instruction-set.mdx | 77 ++-------------- docs/docs/protocol-specs/public-vm/intro.md | 2 +- .../protocol-specs/public-vm/nested-calls.mdx | 4 +- docs/docs/protocol-specs/public-vm/state.md | 4 +- .../InstructionSet/InstructionSet.js | 32 +------ .../aztec-nr/authwit/src/entrypoint/app.nr | 3 +- .../aztec-nr/authwit/src/entrypoint/fee.nr | 3 +- .../aztec/src/context/call_interfaces.nr | 40 --------- .../aztec/src/context/private_context.nr | 37 ++------ .../aztec/src/context/public_context.nr | 10 --- .../oracle/enqueue_public_function_call.nr | 6 -- .../src/dapp_payload.nr | 5 +- .../delegated_on_contract/src/main.nr | 16 +--- .../contracts/delegator_contract/src/main.nr | 17 +--- .../validate_call_requests.nr | 87 ------------------- .../components/public_call_data_validator.nr | 33 ++----- .../src/public_kernel_app_logic.nr | 25 ------ .../src/public_kernel_setup.nr | 44 ---------- .../src/public_kernel_teardown.nr | 55 ------------ .../crates/types/src/constants.nr | 2 - .../crates/types/src/tests/fixture_builder.nr | 30 ++----- yarn-project/circuits.js/src/constants.gen.ts | 2 - .../src/e2e_delegate_calls/delegate.test.ts | 22 ----- .../simulator/src/acvm/oracle/oracle.ts | 4 - .../simulator/src/acvm/oracle/typed_oracle.ts | 2 - .../src/avm/avm_execution_environment.test.ts | 16 ---- .../src/avm/avm_execution_environment.ts | 13 --- yarn-project/simulator/src/avm/avm_gas.ts | 2 - .../simulator/src/avm/fixtures/index.ts | 1 - .../serialization/bytecode_serialization.ts | 1 - .../instruction_serialization.ts | 1 - .../src/client/client_execution_context.ts | 7 +- yarn-project/simulator/src/public/executor.ts | 1 - .../simulator/src/public/side_effect_trace.ts | 2 +- yarn-project/txe/src/oracle/txe_oracle.ts | 8 +- .../txe/src/txe_service/txe_service.ts | 14 +-- 47 files changed, 58 insertions(+), 602 deletions(-) diff --git a/avm-transpiler/src/opcodes.rs b/avm-transpiler/src/opcodes.rs index 23b67dc18f9..b1223ed415a 100644 --- a/avm-transpiler/src/opcodes.rs +++ b/avm-transpiler/src/opcodes.rs @@ -62,7 +62,6 @@ pub enum AvmOpcode { // External calls CALL, STATICCALL, - DELEGATECALL, RETURN, REVERT, // Misc @@ -157,7 +156,6 @@ impl AvmOpcode { // Control Flow - Contract Calls AvmOpcode::CALL => "CALL", AvmOpcode::STATICCALL => "STATICCALL", - AvmOpcode::DELEGATECALL => "DELEGATECALL", AvmOpcode::RETURN => "RETURN", AvmOpcode::REVERT => "REVERT", diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/deserialization.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/deserialization.cpp index bade655927c..7302d4747c3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/deserialization.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/deserialization.cpp @@ -138,7 +138,6 @@ const std::unordered_map> OPCODE_WIRE_FORMAT = // Control Flow - Contract Calls { OpCode::CALL, external_call_format }, // STATICCALL, - // DELEGATECALL, -- not in simulator { OpCode::RETURN, { OperandType::INDIRECT, OperandType::UINT32, OperandType::UINT32 } }, // REVERT, { OpCode::REVERT, { OperandType::INDIRECT, OperandType::UINT32, OperandType::UINT32 } }, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp index 996ddc00fdd..9db455bd62c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp @@ -72,7 +72,6 @@ const std::unordered_map GAS_COST_TABLE = { { OpCode::SENDL2TOL1MSG, make_cost(AVM_SENDL2TOL1MSG_BASE_L2_GAS, 0, AVM_SENDL2TOL1MSG_DYN_L2_GAS, 0) }, { OpCode::CALL, make_cost(AVM_CALL_BASE_L2_GAS, 0, AVM_CALL_DYN_L2_GAS, 0) }, { OpCode::STATICCALL, make_cost(AVM_STATICCALL_BASE_L2_GAS, 0, AVM_STATICCALL_DYN_L2_GAS, 0) }, - { OpCode::DELEGATECALL, make_cost(AVM_DELEGATECALL_BASE_L2_GAS, 0, AVM_DELEGATECALL_DYN_L2_GAS, 0) }, { OpCode::RETURN, make_cost(AVM_RETURN_BASE_L2_GAS, 0, AVM_RETURN_DYN_L2_GAS, 0) }, { OpCode::REVERT, make_cost(AVM_REVERT_BASE_L2_GAS, 0, AVM_REVERT_DYN_L2_GAS, 0) }, { OpCode::DEBUGLOG, make_cost(AVM_DEBUGLOG_BASE_L2_GAS, 0, AVM_DEBUGLOG_DYN_L2_GAS, 0) }, @@ -108,4 +107,4 @@ const FixedGasTable& FixedGasTable::get() return table; } -} // namespace bb::avm_trace \ No newline at end of file +} // namespace bb::avm_trace diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.cpp index cd5ab278177..b5f001a7c51 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.cpp @@ -143,8 +143,6 @@ std::string to_string(OpCode opcode) return "CALL"; case OpCode::STATICCALL: return "STATICCALL"; - case OpCode::DELEGATECALL: - return "DELEGATECALL"; case OpCode::RETURN: return "RETURN"; case OpCode::REVERT: diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.hpp index c70213f355d..6c6c781801b 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.hpp @@ -92,7 +92,6 @@ enum class OpCode : uint8_t { // Control Flow - Contract Calls CALL, STATICCALL, - DELEGATECALL, RETURN, REVERT, diff --git a/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp b/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp index 58c800ec1f5..3bcd64e7c0e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp @@ -113,7 +113,6 @@ #define AVM_SENDL2TOL1MSG_BASE_L2_GAS 260 #define AVM_CALL_BASE_L2_GAS 450 #define AVM_STATICCALL_BASE_L2_GAS 450 -#define AVM_DELEGATECALL_BASE_L2_GAS 0 #define AVM_RETURN_BASE_L2_GAS 140 #define AVM_REVERT_BASE_L2_GAS 140 #define AVM_DEBUGLOG_BASE_L2_GAS 100 @@ -179,7 +178,6 @@ #define AVM_SENDL2TOL1MSG_DYN_L2_GAS 0 #define AVM_CALL_DYN_L2_GAS 50 #define AVM_STATICCALL_DYN_L2_GAS 50 -#define AVM_DELEGATECALL_DYN_L2_GAS 50 #define AVM_RETURN_DYN_L2_GAS 50 #define AVM_REVERT_DYN_L2_GAS 50 #define AVM_DEBUGLOG_DYN_L2_GAS 0 diff --git a/docs/docs/protocol-specs/calls/delegate-calls.md b/docs/docs/protocol-specs/calls/delegate-calls.md index a9edd81b23e..36f416c95b6 100644 --- a/docs/docs/protocol-specs/calls/delegate-calls.md +++ b/docs/docs/protocol-specs/calls/delegate-calls.md @@ -14,4 +14,4 @@ Isn't this a conflation of instances and classes? A contract address represents Perhaps the information that's needed for any kind of 'call' needs to be modified. At the moment it's: contract_address, function_selector. Perhaps it needs to become: contract_address, class_id, function_selector? Then, for an ordinary call, the class_id can be checked to match the one 'baked into ' the contract_address. For a delegatecall, the contract_address can be that of the calling contract (i.e. the storage contract address), and the class_id can be the target class? --> -At the contract level, a caller can initiate a delegate call via a `delegateCallPrivateFunction` or `delegateCallPublicFunction` oracle call. The caller is responsible for asserting that the returned `CallStackItem` has the `is_delegate_call` flag correctly set. +At the contract level, a caller can initiate a delegate call via a `delegateCallPrivateFunction`oracle call. The caller is responsible for asserting that the returned `CallStackItem` has the `is_delegate_call` flag correctly set. Delegate calls to public contract code are not supported. diff --git a/docs/docs/protocol-specs/public-vm/_nested-context.md b/docs/docs/protocol-specs/public-vm/_nested-context.md index c6fbd1824ab..177a5683628 100644 --- a/docs/docs/protocol-specs/public-vm/_nested-context.md +++ b/docs/docs/protocol-specs/public-vm/_nested-context.md @@ -6,24 +6,22 @@ The following shorthand syntax is used to refer to nested context derivation in // instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } isStaticCall = instr.opcode == STATICCALL -isDelegateCall = instr.opcode == DELEGATECALL -nestedContext = deriveContext(context, instr.args, isStaticCall, isDelegateCall) +nestedContext = deriveContext(context, instr.args, isStaticCall) ``` Nested context derivation is defined as follows: ```jsx nestedExecutionEnvironment = ExecutionEnvironment { address: M[addrOffset], - storageAddress: isDelegateCall ? context.storageAddress : M[addrOffset], - sender: isDelegateCall ? context.sender : context.address, + storageAddress: M[addrOffset], + sender: context.address, functionSelector: context.environment.functionSelector, transactionFee: context.environment.transactionFee, contractCallDepth: context.contractCallDepth + 1, contractCallPointer: context.worldStateAccessTrace.contractCalls.length + 1, globals: context.globals, isStaticCall: isStaticCall, - isDelegateCall: isDelegateCall, calldata: context.memory[M[argsOffset]:M[argsOffset]+argsSize], } diff --git a/docs/docs/protocol-specs/public-vm/avm-circuit.md b/docs/docs/protocol-specs/public-vm/avm-circuit.md index 146557a1af3..dbfa91ca647 100644 --- a/docs/docs/protocol-specs/public-vm/avm-circuit.md +++ b/docs/docs/protocol-specs/public-vm/avm-circuit.md @@ -186,7 +186,6 @@ AvmSessionInputs { sender: AztecAddress, contractCallDepth: field, isStaticCall: boolean, - isDelegateCall: boolean, transactionFee: field, // Initializes Machine State l2GasLeft: field, diff --git a/docs/docs/protocol-specs/public-vm/context.mdx b/docs/docs/protocol-specs/public-vm/context.mdx index 6bb784ef606..95486b39576 100644 --- a/docs/docs/protocol-specs/public-vm/context.mdx +++ b/docs/docs/protocol-specs/public-vm/context.mdx @@ -34,7 +34,6 @@ A context's **execution environment** remains constant throughout a contract cal | contractCallPointer | `field` | Uniquely identifies each contract call processed by an AVM session. An initial call is assigned pointer value of 1 (expanded on in the AVM circuit section's ["Call Pointer"](./avm-circuit#call-pointer) subsection). | | globals | `PublicGlobalVariables` | | | isStaticCall | `boolean` | | -| isDelegateCall | `boolean` | | | calldata | `[field; ]` | | ## Contract Call Results @@ -79,7 +78,6 @@ INITIAL_EXECUTION_ENVIRONMENT = ExecutionEnvironment { contractCallPointer: 1, globals: isStaticCall: PublicCallRequest.CallContext.isStaticCall, - isDelegateCall: PublicCallRequest.CallContext.isDelegateCall, calldata: PublicCallRequest.args, } diff --git a/docs/docs/protocol-specs/public-vm/execution.md b/docs/docs/protocol-specs/public-vm/execution.md index ea2fa9e301a..bcd7db87ded 100644 --- a/docs/docs/protocol-specs/public-vm/execution.md +++ b/docs/docs/protocol-specs/public-vm/execution.md @@ -118,11 +118,11 @@ An instruction's gas cost is meant to reflect the computational cost of generati - In addition to the base cost, the cost of an instruction increases with the number of reads and writes to memory. This is affected by the total number of input and outputs: the gas cost for [`AND`](./instruction-set/#isa-section-and) should be greater than that of [`NOT`](./instruction-set/#isa-section-not) since it takes one more input. - Input parameters flagged as "indirect" require an extra memory access, so these should further increase the gas cost of the instruction. - The base cost for instructions that operate on a data range of a specified "size" scale in cost with that size, but only if they perform an operation on the data other than copying. For example, [`CALLDATACOPY`](./instruction-set/#isa-section-calldatacopy) copies `copySize` words from `environment.calldata` to `machineState.memory`, so its increased cost is captured by the extra memory accesses. On the other hand, [`SSTORE`](./instruction-set#isa-section-sstore) requires accesses to persistent storage proportional to `srcSize`, so its base cost should also increase. -- The [`CALL`](./instruction-set#isa-section-call)/[`STATICCALL`](./instruction-set#isa-section-staticcall)/[`DELEGATECALL`](./instruction-set#isa-section-delegatecall) instruction's gas cost is determined by its `*Gas` arguments, but any gas unused by the nested contract call's execution is refunded after its completion ([more on this later](./nested-calls#updating-the-calling-context-after-nested-call-halts)). +- The [`CALL`](./instruction-set#isa-section-call)/[`STATICCALL`](./instruction-set#isa-section-staticcall) instruction's gas cost is determined by its `*Gas` arguments, but any gas unused by the nested contract call's execution is refunded after its completion ([more on this later](./nested-calls#updating-the-calling-context-after-nested-call-halts)). > An instruction's gas cost will roughly align with the number of rows it corresponds to in the SNARK execution trace including rows in the sub-operation table, memory table, chiplet tables, etc. -> An instruction's gas cost takes into account the costs of associated downstream computations. An instruction that triggers accesses to the public data tree (`SLOAD`/`SSTORE`) incurs a cost that accounts for state access validation in later circuits (public kernel or rollup). A contract call instruction (`CALL`/`STATICCALL`/`DELEGATECALL`) incurs a cost accounting for the nested call's complete execution as well as any work required by the public kernel circuit for this additional call. +> An instruction's gas cost takes into account the costs of associated downstream computations. An instruction that triggers accesses to the public data tree (`SLOAD`/`SSTORE`) incurs a cost that accounts for state access validation in later circuits (public kernel or rollup). A contract call instruction (`CALL`/`STATICCALL`) incurs a cost accounting for the nested call's complete execution as well as any work required by the public kernel circuit for this additional call. ## Halting @@ -188,13 +188,13 @@ The AVM's exceptional halting conditions area listed below: 1. **Maximum contract call depth (1024) exceeded** ``` assert environment.contractCallDepth <= 1024 - assert instructions[machineState.pc].opcode not in {CALL, STATICCALL, DELEGATECALL} + assert instructions[machineState.pc].opcode not in {CALL, STATICCALL} OR environment.contractCallDepth < 1024 ``` 1. **Maximum contract call calls per execution request (1024) exceeded** ``` assert worldStateAccessTrace.contractCalls.length <= 1024 - assert instructions[machineState.pc].opcode not in {CALL, STATICCALL, DELEGATECALL} + assert instructions[machineState.pc].opcode not in {CALL, STATICCALL} OR worldStateAccessTrace.contractCalls.length < 1024 ``` 1. **Maximum internal call depth (1024) exceeded** diff --git a/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx b/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx index 76a1afddf45..04fa4cd5c7c 100644 --- a/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx +++ b/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx @@ -463,7 +463,7 @@ chargeGas(context, l2GasCost=M[instr.args.gasOffset], daGasCost=M[instr.args.gasOffset+1]) traceNestedCall(context, instr.args.addrOffset) -nestedContext = deriveContext(context, instr.args, isStaticCall=false, isDelegateCall=false) +nestedContext = deriveContext(context, instr.args, isStaticCall=false) execute(nestedContext) updateContextAfterNestedCall(context, instr.args, nestedContext)`} @@ -478,28 +478,13 @@ chargeGas(context, l2GasCost=M[instr.args.gasOffset], daGasCost=M[instr.args.gasOffset+1]) traceNestedCall(context, instr.args.addrOffset) -nestedContext = deriveContext(context, instr.args, isStaticCall=true, isDelegateCall=false) +nestedContext = deriveContext(context, instr.args, isStaticCall=true) execute(nestedContext) updateContextAfterNestedCall(context, instr.args, nestedContext)`} 0x34 - \[\`DELEGATECALL\`\](#isa-section-delegatecall) - (UNIMPLEMENTED) Call into another contract, but keep the caller's `sender` and `storageAddress` - -{`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } -chargeGas(context, - l2GasCost=M[instr.args.gasOffset], - daGasCost=M[instr.args.gasOffset+1]) -traceNestedCall(context, instr.args.addrOffset) -nestedContext = deriveContext(context, instr.args, isStaticCall=false, isDelegateCall=true) -execute(nestedContext) -updateContextAfterNestedCall(context, instr.args, nestedContext)`} - - - - 0x35 \[\`RETURN\`\](#isa-section-return) Halt execution within this context (without revert), optionally returning some data @@ -508,7 +493,7 @@ halt`} - 0x36 + 0x35 \[\`REVERT\`\](#isa-section-revert) Halt execution within this context as `reverted`, optionally returning some data @@ -518,7 +503,7 @@ halt`} - 0x37 + 0x36 \[\`TORADIXLE\`\](#isa-section-to_radix_le) Convert a word to an array of limbs in little-endian radix form TBD: Storage of limbs and if T[dstOffset] is constrained to U8 @@ -1667,7 +1652,7 @@ chargeGas(context, l2GasCost=M[instr.args.gasOffset], daGasCost=M[instr.args.gasOffset+1]) traceNestedCall(context, instr.args.addrOffset) -nestedContext = deriveContext(context, instr.args, isStaticCall=false, isDelegateCall=false) +nestedContext = deriveContext(context, instr.args, isStaticCall=false) execute(nestedContext) updateContextAfterNestedCall(context, instr.args, nestedContext)`} @@ -1714,7 +1699,7 @@ chargeGas(context, l2GasCost=M[instr.args.gasOffset], daGasCost=M[instr.args.gasOffset+1]) traceNestedCall(context, instr.args.addrOffset) -nestedContext = deriveContext(context, instr.args, isStaticCall=true, isDelegateCall=false) +nestedContext = deriveContext(context, instr.args, isStaticCall=true) execute(nestedContext) updateContextAfterNestedCall(context, instr.args, nestedContext)`} @@ -1734,56 +1719,12 @@ T[retOffset:retOffset+retSize] = field`} [![](/img/protocol-specs/public-vm/bit-formats/STATICCALL.png)](/img/protocol-specs/public-vm/bit-formats/STATICCALL.png) -### `DELEGATECALL` -(UNIMPLEMENTED) Call into another contract, but keep the caller's `sender` and `storageAddress` - -[See in table.](#isa-table-delegatecall) - -- **Opcode**: 0x34 -- **Category**: Control Flow - Contract Calls -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **gasOffset**: offset to two words containing `{l2GasLeft, daGasLeft}`: amount of gas to provide to the callee - - **addrOffset**: address of the contract to call - - **argsOffset**: memory offset to args (will become the callee's calldata) - - **argsSizeOffset**: memory offset for the number of words to pass via callee's calldata - - **retOffset**: destination memory offset specifying where to store the data returned from the callee - - **retSize**: number of words to copy from data returned by callee - - **successOffset**: destination memory offset specifying where to store the call's success (0: failure, 1: success) -- **Expression**: - -{`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } -chargeGas(context, - l2GasCost=M[instr.args.gasOffset], - daGasCost=M[instr.args.gasOffset+1]) -traceNestedCall(context, instr.args.addrOffset) -nestedContext = deriveContext(context, instr.args, isStaticCall=false, isDelegateCall=true) -execute(nestedContext) -updateContextAfterNestedCall(context, instr.args, nestedContext)`} - -- **Details**: Same as `CALL`, but `sender` and `storageAddress` remains - the same in the nested call as they were in the caller. - ["Nested contract calls"](./nested-calls) provides a full explanation of this - instruction along with the shorthand used in the expression above. - The explanation includes details on charging gas for nested calls, - nested context derivation, world state tracing, and updating the parent context - after the nested call halts. -- **Tag checks**: `T[gasOffset] == T[gasOffset+1] == T[gasOffset+2] == u32` -- **Tag updates**: - -{`T[successOffset] = u8 -T[retOffset:retOffset+retSize] = field`} - -- **Bit-size**: 248 - - ### `RETURN` Halt execution within this context (without revert), optionally returning some data [See in table.](#isa-table-return) -- **Opcode**: 0x35 +- **Opcode**: 0x34 - **Category**: Control Flow - Contract Calls - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1805,7 +1746,7 @@ Halt execution within this context as `reverted`, optionally returning some data [See in table.](#isa-table-revert) -- **Opcode**: 0x36 +- **Opcode**: 0x35 - **Category**: Control Flow - Contract Calls - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1828,7 +1769,7 @@ Convert a word to an array of limbs in little-endian radix form [See in table.](#isa-table-to_radix_le) -- **Opcode**: 0x37 +- **Opcode**: 0x36 - **Category**: Conversions - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. diff --git a/docs/docs/protocol-specs/public-vm/intro.md b/docs/docs/protocol-specs/public-vm/intro.md index a89e45fc1b2..3319cc2ae4a 100644 --- a/docs/docs/protocol-specs/public-vm/intro.md +++ b/docs/docs/protocol-specs/public-vm/intro.md @@ -12,7 +12,7 @@ In order to execute public contract bytecode, the AVM requires some context. An Instruction-by-instruction, the AVM [executes](./execution) the bytecode specified in its context. An **instruction** is a decoded bytecode entry that, when executed, modifies the AVM's execution context (in particular its [state](./state)) according to the instruction's definition in the ["AVM Instruction Set"](./instruction-set). Execution within a context ends when the AVM encounters a [**halt**](./execution#halting). -During execution, additional contract calls may be made. While an [**initial contract call**](./context#initial-contract-calls) initializes a new execution context directly from a public execution request, a [**nested contract call**](./nested-calls) occurs _during_ AVM execution and is triggered by a **contract call instruction** ([`CALL`](./instruction-set#isa-section-call), [`STATICCALL`](./instruction-set#isa-section-staticcall), or [`DELEGATECALL`](./instruction-set#isa-section-delegatecall)). It initializes a new execution context (**nested context**) from the current one (**calling context**) and triggers execution within it. When nested call's execution completes, execution proceeds in the calling context. +During execution, additional contract calls may be made. While an [**initial contract call**](./context#initial-contract-calls) initializes a new execution context directly from a public execution request, a [**nested contract call**](./nested-calls) occurs _during_ AVM execution and is triggered by a **contract call instruction** ([`CALL`](./instruction-set#isa-section-call) or [`STATICCALL`](./instruction-set#isa-section-staticcall). It initializes a new execution context (**nested context**) from the current one (**calling context**) and triggers execution within it. When nested call's execution completes, execution proceeds in the calling context. A **caller** is a contract call's initiator. The caller of an initial contract call is an Aztec sequencer. The caller of a nested contract call is the AVM itself executing in the calling context. diff --git a/docs/docs/protocol-specs/public-vm/nested-calls.mdx b/docs/docs/protocol-specs/public-vm/nested-calls.mdx index 182a248fbed..7105e28f462 100644 --- a/docs/docs/protocol-specs/public-vm/nested-calls.mdx +++ b/docs/docs/protocol-specs/public-vm/nested-calls.mdx @@ -1,6 +1,6 @@ # Nested Contract Calls -A **nested contract call** occurs _during_ AVM execution and is triggered by a **contract call instruction**. The AVM [instruction set](./instruction-set) includes three contract call instructions: [`CALL`](./instruction-set#isa-section-call), [`STATICCALL`](./instruction-set#isa-section-staticcall), and [`DELEGATECALL`](./instruction-set#isa-section-delegatecall). +A **nested contract call** occurs _during_ AVM execution and is triggered by a **contract call instruction**. The AVM [instruction set](./instruction-set) includes three contract call instructions: [`CALL`](./instruction-set#isa-section-call) and [`STATICCALL`](./instruction-set#isa-section-staticcall). A nested contract call performs the following operations: @@ -16,7 +16,6 @@ Or, in pseudocode: // instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } isStaticCall = instr.opcode == STATICCALL; -isDelegateCall = instr.opcode == DELEGATECALL; l2GasCost = min(M[instr.args.gasOffset], context.machineState.l2GasLeft); daGasCost = min(M[instr.args.gasOffset + 1], context.machineState.daGasLeft); @@ -26,7 +25,6 @@ nestedContext = deriveContext( context, instr.args, isStaticCall, - isDelegateCall ); execute(nestedContext); updateContextAfterNestedCall(context, instr.args, nestedContext); diff --git a/docs/docs/protocol-specs/public-vm/state.md b/docs/docs/protocol-specs/public-vm/state.md index e81b6299c83..d85a9062439 100644 --- a/docs/docs/protocol-specs/public-vm/state.md +++ b/docs/docs/protocol-specs/public-vm/state.md @@ -54,7 +54,7 @@ The following table defines an AVM context's world state interface: | `l1ToL2Messages` | [`L1TOL2MSGEXISTS`](./instruction-set#isa-section-l1tol2msgexists) (membership-checks (start-of-block)) | | `headers` | [`HEADERMEMBER`](./instruction-set#isa-section-headermember) (membership-checks & leaf-preimage-reads) | -> \* `*CALL` is short for `CALL`/`STATICCALL`/`DELEGATECALL`. +> \* `*CALL` is short for `CALL`/`STATICCALL`. > \* For the purpose of the AVM, the world state's `contracts` member is readable for [bytecode fetching](./execution#bytecode-fetch-and-decode), and it is effectively updated when a new contract class or instance is created (along with a nullifier for the contract class identifier or contract address). @@ -85,7 +85,7 @@ Each entry in the world state access trace is listed below along with its type a > The types tracked in these trace vectors are defined [here](./type-structs). -> `*CALL` is short for `CALL`/`STATICCALL`/`DELEGATECALL`. +> `*CALL` is short for `CALL`/`STATICCALL`. > Aztec tree operations like membership checks, appends, or leaf updates are performed in-circuit by downstream circuits (public kernel and rollup circuits), _after_ AVM execution. The world state access trace is a list of requests made by the AVM for later circuits to perform. diff --git a/docs/src/preprocess/InstructionSet/InstructionSet.js b/docs/src/preprocess/InstructionSet/InstructionSet.js index 129a41a6e1a..5500db803c4 100644 --- a/docs/src/preprocess/InstructionSet/InstructionSet.js +++ b/docs/src/preprocess/InstructionSet/InstructionSet.js @@ -1400,7 +1400,7 @@ chargeGas(context, l2GasCost=M[instr.args.gasOffset], daGasCost=M[instr.args.gasOffset+1]) traceNestedCall(context, instr.args.addrOffset) -nestedContext = deriveContext(context, instr.args, isStaticCall=false, isDelegateCall=false) +nestedContext = deriveContext(context, instr.args, isStaticCall=false) execute(nestedContext) updateContextAfterNestedCall(context, instr.args, nestedContext) `, @@ -1429,7 +1429,7 @@ chargeGas(context, l2GasCost=M[instr.args.gasOffset], daGasCost=M[instr.args.gasOffset+1]) traceNestedCall(context, instr.args.addrOffset) -nestedContext = deriveContext(context, instr.args, isStaticCall=true, isDelegateCall=false) +nestedContext = deriveContext(context, instr.args, isStaticCall=true) execute(nestedContext) updateContextAfterNestedCall(context, instr.args, nestedContext) `, @@ -1442,34 +1442,6 @@ updateContextAfterNestedCall(context, instr.args, nestedContext) "Tag updates": ` T[successOffset] = u8 T[retOffset:retOffset+retSize] = field -`, - }, - { - id: "delegatecall", - Name: "`DELEGATECALL`", - Category: "Control Flow - Contract Calls", - Flags: [{ name: "indirect", description: INDIRECT_FLAG_DESCRIPTION }], - Args: CALL_INSTRUCTION_ARGS, - Expression: ` -// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } -chargeGas(context, - l2GasCost=M[instr.args.gasOffset], - daGasCost=M[instr.args.gasOffset+1]) -traceNestedCall(context, instr.args.addrOffset) -nestedContext = deriveContext(context, instr.args, isStaticCall=false, isDelegateCall=true) -execute(nestedContext) -updateContextAfterNestedCall(context, instr.args, nestedContext) -`, - Summary: - "(UNIMPLEMENTED) Call into another contract, but keep the caller's `sender` and `storageAddress`", - Details: - `Same as \`CALL\`, but \`sender\` and \`storageAddress\` remains - the same in the nested call as they were in the caller. ` + - CALL_INSTRUCTION_DETAILS, - "Tag checks": "`T[gasOffset] == T[gasOffset+1] == T[gasOffset+2] == u32`", - "Tag updates": ` -T[successOffset] = u8 -T[retOffset:retOffset+retSize] = field `, }, { diff --git a/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr b/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr index 663ae8044a6..b1828eacfbd 100644 --- a/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr +++ b/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr @@ -66,7 +66,6 @@ impl AppPayload { call.function_selector, call.args_hash, call.is_static, - false ); } else { let _result = context.call_private_function_with_packed_args( @@ -74,7 +73,7 @@ impl AppPayload { call.function_selector, call.args_hash, call.is_static, - false + /*is_delegate_call=*/ false ); } } diff --git a/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr b/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr index f7d0ea258fc..9e17a102935 100644 --- a/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr +++ b/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr @@ -65,7 +65,6 @@ impl FeePayload { call.function_selector, call.args_hash, call.is_static, - false ); } else { let _result = context.call_private_function_with_packed_args( @@ -73,7 +72,7 @@ impl FeePayload { call.function_selector, call.args_hash, call.is_static, - false + /*is_delegate_call=*/ false ); } } diff --git a/noir-projects/aztec-nr/aztec/src/context/call_interfaces.nr b/noir-projects/aztec-nr/aztec/src/context/call_interfaces.nr index a42d80c8019..87bcfaad745 100644 --- a/noir-projects/aztec-nr/aztec/src/context/call_interfaces.nr +++ b/noir-projects/aztec-nr/aztec/src/context/call_interfaces.nr @@ -196,11 +196,6 @@ impl PublicCallInterface { returns.deserialize_into() } - pub fn delegate_call(self, context: &mut PublicContext) -> T where T: Deserialize { - let returns = context.delegate_call_public_function(self.target_contract, self.selector, self.args); - returns.deserialize_into() - } - pub fn enqueue(self, context: &mut PrivateContext) { let args_hash = hash_args(self.args); assert(args_hash == pack_arguments(self.args)); @@ -209,7 +204,6 @@ impl PublicCallInterface { self.selector, args_hash, /*static=*/ false, - /*delegate=*/ false ) } @@ -221,19 +215,6 @@ impl PublicCallInterface { self.selector, args_hash, /*static=*/ true, - /*delegate=*/ false - ) - } - - pub fn delegate_enqueue(self, context: &mut PrivateContext) { - let args_hash = hash_args(self.args); - assert(args_hash == pack_arguments(self.args)); - context.call_public_function_with_packed_args( - self.target_contract, - self.selector, - args_hash, - /*static=*/ false, - /*delegate=*/ true ) } } @@ -270,11 +251,6 @@ impl PublicVoidCallInterface { returns.assert_empty() } - pub fn delegate_call(self, context: &mut PublicContext) { - let returns = context.delegate_call_public_function(self.target_contract, self.selector, self.args); - returns.assert_empty() - } - pub fn enqueue(self, context: &mut PrivateContext) { let args_hash = hash_args(self.args); assert(args_hash == pack_arguments(self.args)); @@ -283,7 +259,6 @@ impl PublicVoidCallInterface { self.selector, args_hash, /*static=*/ false, - /*delegate=*/ false ) } @@ -295,19 +270,6 @@ impl PublicVoidCallInterface { self.selector, args_hash, /*static=*/ true, - /*delegate=*/ false - ) - } - - pub fn delegate_enqueue(self, context: &mut PrivateContext) { - let args_hash = hash_args(self.args); - assert(args_hash == pack_arguments(self.args)); - context.call_public_function_with_packed_args( - self.target_contract, - self.selector, - args_hash, - /*static=*/ false, - /*delegate=*/ true ) } } @@ -348,7 +310,6 @@ impl PublicStaticCallInterface { self.selector, args_hash, /*static=*/ true, - /*delegate=*/ false ) } } @@ -388,7 +349,6 @@ impl PublicStaticVoidCallInterface { self.selector, args_hash, /*static=*/ true, - /*delegate=*/ false ) } } diff --git a/noir-projects/aztec-nr/aztec/src/context/private_context.nr b/noir-projects/aztec-nr/aztec/src/context/private_context.nr index 8ea2ddc9014..d00b54202e2 100644 --- a/noir-projects/aztec-nr/aztec/src/context/private_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/private_context.nr @@ -410,7 +410,7 @@ impl PrivateContext { ) { let args_hash = hash_args_array(args); assert(args_hash == arguments::pack_arguments_array(args)); - self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, false, false) + self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, false) } pub fn static_call_public_function( @@ -421,18 +421,7 @@ impl PrivateContext { ) { let args_hash = hash_args_array(args); assert(args_hash == arguments::pack_arguments_array(args)); - self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, true, false) - } - - pub fn delegate_call_public_function( - &mut self, - contract_address: AztecAddress, - function_selector: FunctionSelector, - args: [Field; ARGS_COUNT] - ) { - let args_hash = hash_args_array(args); - assert(args_hash == arguments::pack_arguments_array(args)); - self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, false, true) + self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, true) } pub fn call_public_function_no_args( @@ -440,7 +429,7 @@ impl PrivateContext { contract_address: AztecAddress, function_selector: FunctionSelector ) { - self.call_public_function_with_packed_args(contract_address, function_selector, 0, false, false) + self.call_public_function_with_packed_args(contract_address, function_selector, 0, false) } pub fn static_call_public_function_no_args( @@ -448,15 +437,7 @@ impl PrivateContext { contract_address: AztecAddress, function_selector: FunctionSelector ) { - self.call_public_function_with_packed_args(contract_address, function_selector, 0, true, false) - } - - pub fn delegate_call_public_function_no_args( - &mut self, - contract_address: AztecAddress, - function_selector: FunctionSelector - ) { - self.call_public_function_with_packed_args(contract_address, function_selector, 0, false, true) + self.call_public_function_with_packed_args(contract_address, function_selector, 0, true) } pub fn call_public_function_with_packed_args( @@ -465,7 +446,6 @@ impl PrivateContext { function_selector: FunctionSelector, args_hash: Field, is_static_call: bool, - is_delegate_call: bool ) { let counter = self.next_counter(); @@ -476,14 +456,13 @@ impl PrivateContext { args_hash, counter, is_static_call, - is_delegate_call ); let call_context = self.generate_call_context( contract_address, function_selector, is_static_call, - is_delegate_call + /*is_delegate_call=*/ false, ); let item = PublicCallStackItemCompressed { @@ -508,7 +487,7 @@ impl PrivateContext { ) { let args_hash = hash_args_array(args); assert(args_hash == arguments::pack_arguments_array(args)); - self.set_public_teardown_function_with_packed_args(contract_address, function_selector, args_hash, false, false) + self.set_public_teardown_function_with_packed_args(contract_address, function_selector, args_hash, false) } pub fn set_public_teardown_function_with_packed_args( @@ -517,7 +496,6 @@ impl PrivateContext { function_selector: FunctionSelector, args_hash: Field, is_static_call: bool, - is_delegate_call: bool ) { let counter = self.next_counter(); @@ -528,14 +506,13 @@ impl PrivateContext { args_hash, counter, is_static_call, - is_delegate_call ); let call_context = self.generate_call_context( contract_address, function_selector, is_static_call, - is_delegate_call + /*is_delegate_call=*/ false, ); let item = PublicCallStackItemCompressed { diff --git a/noir-projects/aztec-nr/aztec/src/context/public_context.nr b/noir-projects/aztec-nr/aztec/src/context/public_context.nr index 762fde1c1c8..d77352c95d9 100644 --- a/noir-projects/aztec-nr/aztec/src/context/public_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/public_context.nr @@ -101,16 +101,6 @@ impl PublicContext { FunctionReturns::new(data_to_return) } - fn delegate_call_public_function( - _self: &mut Self, - _contract_address: AztecAddress, - _function_selector: FunctionSelector, - _args: [Field] - ) -> FunctionReturns { - assert(false, "'delegate_call_public_function' not implemented!"); - FunctionReturns::new([0; RETURNS_COUNT]) - } - fn push_note_hash(_self: &mut Self, note_hash: Field) { emit_note_hash(note_hash); } diff --git a/noir-projects/aztec-nr/aztec/src/oracle/enqueue_public_function_call.nr b/noir-projects/aztec-nr/aztec/src/oracle/enqueue_public_function_call.nr index 484c4e59030..a8b6602c94a 100644 --- a/noir-projects/aztec-nr/aztec/src/oracle/enqueue_public_function_call.nr +++ b/noir-projects/aztec-nr/aztec/src/oracle/enqueue_public_function_call.nr @@ -7,7 +7,6 @@ unconstrained fn enqueue_public_function_call_oracle( _args_hash: Field, _side_effect_counter: u32, _is_static_call: bool, - _is_delegate_call: bool ) {} unconstrained pub fn enqueue_public_function_call_internal( @@ -16,7 +15,6 @@ unconstrained pub fn enqueue_public_function_call_internal( args_hash: Field, side_effect_counter: u32, is_static_call: bool, - is_delegate_call: bool ) { enqueue_public_function_call_oracle( contract_address, @@ -24,7 +22,6 @@ unconstrained pub fn enqueue_public_function_call_internal( args_hash, side_effect_counter, is_static_call, - is_delegate_call ); } @@ -35,7 +32,6 @@ unconstrained fn set_public_teardown_function_call_oracle( _args_hash: Field, _side_effect_counter: u32, _is_static_call: bool, - _is_delegate_call: bool ) {} unconstrained pub fn set_public_teardown_function_call_internal( @@ -44,7 +40,6 @@ unconstrained pub fn set_public_teardown_function_call_internal( args_hash: Field, side_effect_counter: u32, is_static_call: bool, - is_delegate_call: bool ) { set_public_teardown_function_call_oracle( contract_address, @@ -52,7 +47,6 @@ unconstrained pub fn set_public_teardown_function_call_internal( args_hash, side_effect_counter, is_static_call, - is_delegate_call ); } diff --git a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/dapp_payload.nr b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/dapp_payload.nr index d04cfb8f4f2..58e414819eb 100644 --- a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/dapp_payload.nr +++ b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/dapp_payload.nr @@ -66,8 +66,7 @@ impl DAppPayload { call.target_address, call.function_selector, call.args_hash, - call.is_static, - false + call.is_static ); } else { let _result = context.call_private_function_with_packed_args( @@ -75,7 +74,7 @@ impl DAppPayload { call.function_selector, call.args_hash, call.is_static, - false + /*is_delegate_call=*/ false ); } } diff --git a/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr b/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr index 6b96e9e723e..28997831d45 100644 --- a/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr @@ -1,9 +1,6 @@ // A contract used along with `Parent` contract to test nested calls. contract DelegatedOn { - use dep::aztec::prelude::{ - AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, NoteViewerOptions, PublicMutable, - PrivateSet, PrivateContext, Map - }; + use dep::aztec::prelude::{AztecAddress, NoteGetterOptions, PrivateSet, Map}; use dep::aztec::{ encrypted_logs::encrypted_note_emission::encode_and_encrypt_note, keys::getters::get_current_public_keys @@ -12,7 +9,6 @@ contract DelegatedOn { #[aztec(storage)] struct Storage { - current_value: PublicMutable, a_map_with_private_values: Map>, } @@ -25,12 +21,6 @@ contract DelegatedOn { new_value } - #[aztec(public)] - fn public_set_value(new_value: Field) -> Field { - storage.current_value.write(new_value); - new_value - } - #[aztec(private)] fn get_private_value(amount: Field, owner: AztecAddress) -> pub Field { let mut options = NoteGetterOptions::new(); @@ -38,9 +28,5 @@ contract DelegatedOn { let notes = storage.a_map_with_private_values.at(owner).get_notes(options); notes.get(0).value } - - unconstrained fn view_public_value() -> pub Field { - storage.current_value.read() - } } diff --git a/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr b/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr index 8cb753c23e9..3a483dafb14 100644 --- a/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr @@ -1,12 +1,11 @@ // A contract used along with `Parent` contract to test nested calls. contract Delegator { - use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PublicMutable, PrivateSet, Deserialize, Map}; + use dep::aztec::prelude::{AztecAddress, NoteGetterOptions, PublicMutable, PrivateSet, Map}; use dep::value_note::value_note::ValueNote; use dep::delegated_on::DelegatedOn; #[aztec(storage)] struct Storage { - current_value: PublicMutable, a_map_with_private_values: Map>, } @@ -20,16 +19,6 @@ contract Delegator { DelegatedOn::at(target_contract).private_set_value(value, owner).delegate_call(&mut context) } - #[aztec(private)] - fn enqueued_delegate_set_value(target_contract: AztecAddress, value: Field) { - DelegatedOn::at(target_contract).public_set_value(value).delegate_enqueue(&mut context) - } - - #[aztec(public)] - fn public_delegate_set_value(target_contract: AztecAddress, value: Field) -> Field { - DelegatedOn::at(target_contract).public_set_value(value).delegate_call(&mut context) - } - #[aztec(private)] fn get_private_value(amount: Field, owner: AztecAddress) -> pub Field { let mut options = NoteGetterOptions::new(); @@ -37,8 +26,4 @@ contract Delegator { let notes = storage.a_map_with_private_values.at(owner).get_notes(options); notes.get_unchecked(0).value } - - unconstrained fn view_public_value() -> pub Field { - storage.current_value.read() - } } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_call_requests.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_call_requests.nr index fdfb832fce2..e34997d5a2f 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_call_requests.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_call_requests.nr @@ -13,57 +13,11 @@ fn validate_public_call_requests_succeeds() { builder.validate(); } -#[test] -fn validate_public_call_requests_delegate_call_succeeds() { - let mut builder = PrivateCallDataValidatorBuilder::new(); - - builder.private_call.append_public_call_requests_delegate(2); - - builder.validate(); -} - -#[test] -fn validate_public_call_requests_mix_succeeds() { - let mut builder = PrivateCallDataValidatorBuilder::new(); - - builder.private_call.append_public_call_requests(1); - builder.private_call.append_public_call_requests_delegate(1); - builder.private_call.append_public_call_requests(1); - - builder.validate(); -} - #[test] fn validate_public_call_requests_from_static_call_succeeds() { let mut builder = PrivateCallDataValidatorBuilder::new().is_static_call(); builder.private_call.append_public_call_requests(1); - builder.private_call.append_public_call_requests_delegate(1); - builder.private_call.append_public_call_requests(1); - - builder.validate(); -} - -#[test(should_fail_with="incorrect msg_sender for delegate call request")] -fn validate_public_call_requests_incorrect_msg_sender_for_delegate_call_fails() { - let mut builder = PrivateCallDataValidatorBuilder::new(); - - builder.private_call.append_public_call_requests_delegate(1); - // Change the msg_sender to be the contract address. - builder.private_call.public_call_requests.storage[0].item.call_context.msg_sender = builder.private_call.contract_address; - - builder.validate(); -} - -#[test(should_fail_with="incorrect storage_contract_address for delegate call request")] -fn validate_public_call_requests_incorrect_storage_contract_address_for_delegate_call_fails() { - let mut builder = PrivateCallDataValidatorBuilder::new(); - - builder.private_call.append_public_call_requests_delegate(1); - // Change the storage_contract_address to be the target contract address. - let target_contract = builder.private_call.public_call_requests.storage[0].item.contract_address; - builder.private_call.public_call_requests.storage[0].item.call_context.storage_contract_address = target_contract; - builder.validate(); } @@ -113,15 +67,6 @@ fn validate_teardown_call_request_succeeds() { builder.validate(); } -#[test] -fn validate_teardown_call_request_delegate_call_succeeds() { - let mut builder = PrivateCallDataValidatorBuilder::new(); - - builder.private_call.append_public_teardown_call_request_delegate(); - - builder.validate(); -} - #[test] fn validate_teardown_call_request_from_static_call_succeeds() { let mut builder = PrivateCallDataValidatorBuilder::new().is_static_call(); @@ -131,38 +76,6 @@ fn validate_teardown_call_request_from_static_call_succeeds() { builder.validate(); } -#[test] -fn validate_teardown_call_request_delegate_from_static_call_succeeds() { - let mut builder = PrivateCallDataValidatorBuilder::new().is_static_call(); - - builder.private_call.append_public_teardown_call_request_delegate(); - - builder.validate(); -} - -#[test(should_fail_with="incorrect msg_sender for delegate call request")] -fn validate_teardown_call_request_incorrect_msg_sender_for_delegate_call_fails() { - let mut builder = PrivateCallDataValidatorBuilder::new(); - - builder.private_call.append_public_teardown_call_request_delegate(); - // Change the msg_sender to be the contract address. - builder.private_call.public_teardown_call_stack.storage[0].item.call_context.msg_sender = builder.private_call.contract_address; - - builder.validate(); -} - -#[test(should_fail_with="incorrect storage_contract_address for delegate call request")] -fn validate_teardown_call_request_incorrect_storage_contract_address_for_delegate_call_fails() { - let mut builder = PrivateCallDataValidatorBuilder::new(); - - builder.private_call.append_public_teardown_call_request_delegate(); - // Change the storage_contract_address to be the target contract address. - let target_contract = builder.private_call.public_teardown_call_stack.storage[0].item.contract_address; - builder.private_call.public_teardown_call_stack.storage[0].item.call_context.storage_contract_address = target_contract; - - builder.validate(); -} - #[test(should_fail_with="incorrect msg_sender for call request")] fn validate_teardown_call_request_incorrect_msg_sender_for_regular_call_fails() { let mut builder = PrivateCallDataValidatorBuilder::new(); diff --git a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/components/public_call_data_validator.nr b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/components/public_call_data_validator.nr index c4b906c8d68..7a840de7615 100644 --- a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/components/public_call_data_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/components/public_call_data_validator.nr @@ -55,15 +55,9 @@ impl PublicCallDataValidator { let public_inputs = call_stack_item.public_inputs; let call_context = public_inputs.call_context; - if call_context.is_delegate_call { - assert( - !call_stack_item.contract_address.eq(call_context.storage_contract_address), "curent contract address must not match storage contract address for delegate calls" - ); - } else { - assert( - call_context.storage_contract_address.eq(call_stack_item.contract_address), "call stack storage address does not match expected contract address" - ); - } + assert( + call_context.storage_contract_address.eq(call_stack_item.contract_address), "call stack storage address does not match expected contract address" + ); if call_context.is_static_call { // No state changes are allowed for static calls: @@ -95,21 +89,12 @@ impl PublicCallDataValidator { let target_context = request.item.call_context; let target_contract = request.item.contract_address; - if target_context.is_delegate_call { - assert_eq( - target_context.msg_sender, this_context.msg_sender, "incorrect msg_sender for delegate call request" - ); - assert_eq( - target_context.storage_contract_address, this_context.storage_contract_address, "incorrect storage_contract_address for delegate call request" - ); - } else { - assert_eq( - target_context.msg_sender, this_context.storage_contract_address, "incorrect msg_sender for call request" - ); - assert_eq( - target_context.storage_contract_address, target_contract, "incorrect storage_contract_address for call request" - ); - } + assert_eq( + target_context.msg_sender, this_context.storage_contract_address, "incorrect msg_sender for call request" + ); + assert_eq( + target_context.storage_contract_address, target_contract, "incorrect storage_contract_address for call request" + ); if !target_context.is_static_call { assert(this_context.is_static_call == false, "static call cannot make non-static calls"); } diff --git a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_app_logic.nr b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_app_logic.nr index 7f6b5f4e93b..ff64efc333f 100644 --- a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_app_logic.nr +++ b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_app_logic.nr @@ -78,11 +78,6 @@ mod tests { PublicKernelAppLogicCircuitPrivateInputsBuilder { previous_kernel, previous_non_revertible, public_call } } - pub fn is_delegate_call(&mut self) -> Self { - let _ = self.public_call.is_delegate_call(); - *self - } - pub fn to_public_data_reads(self, contract_storage_reads: [StorageRead; N]) -> [PublicDataRead; N] { let storage_contract_address = self.public_call.storage_contract_address; contract_storage_reads.map(|r: StorageRead| PublicDataRead::from_contract_storage_read(storage_contract_address, r)) @@ -314,15 +309,6 @@ mod tests { builder.failed(); } - #[test(should_fail_with="curent contract address must not match storage contract address for delegate calls")] - fn previous_public_kernel_fails_if_incorrect_storage_contract_on_delegate_call() { - let mut builder = PublicKernelAppLogicCircuitPrivateInputsBuilder::new().is_delegate_call(); - - builder.public_call.contract_address = builder.public_call.storage_contract_address; - - builder.failed(); - } - #[test(should_fail_with="note_hashes must be empty for static calls")] fn public_kernel_fails_creating_note_hashes_on_static_call() { let mut builder = PublicKernelAppLogicCircuitPrivateInputsBuilder::new(); @@ -341,17 +327,6 @@ mod tests { builder.failed(); } - #[test(should_fail_with="call stack item does not match item at the top of the call stack")] - fn public_kernel_circuit_fails_on_incorrect_storage_contract_in_delegate_call() { - let mut builder = PublicKernelAppLogicCircuitPrivateInputsBuilder::new().is_delegate_call(); - - let mut item = builder.get_call_request_item(); - // Set the storage contract address to be the contract address. - item.call_context.storage_contract_address = builder.public_call.contract_address; - - builder.failed_with_call_request_item(item); - } - #[test] fn circuit_outputs_should_be_correctly_populated_with_public_call_requests() { let mut builder = PublicKernelAppLogicCircuitPrivateInputsBuilder::new(); diff --git a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_setup.nr b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_setup.nr index 793f9083f0c..10af03e229a 100644 --- a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_setup.nr +++ b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_setup.nr @@ -85,11 +85,6 @@ mod tests { PublicKernelSetupCircuitPrivateInputsBuilder { previous_kernel, previous_revertible, public_call } } - pub fn is_delegate_call(&mut self) -> Self { - let _ = self.public_call.is_delegate_call(); - *self - } - pub fn to_public_data_reads(self, contract_storage_reads: [StorageRead; N]) -> [PublicDataRead; N] { let storage_contract_address = self.public_call.storage_contract_address; contract_storage_reads.map(|r: StorageRead| PublicDataRead::from_contract_storage_read(storage_contract_address, r)) @@ -210,32 +205,6 @@ mod tests { builder.failed(); } - #[test] - fn delegate_call_succeeds() { - let mut builder = PublicKernelSetupCircuitPrivateInputsBuilder::new().is_delegate_call(); - builder.succeeded(); - } - - #[test(should_fail_with="call stack item does not match item at the top of the call stack")] - fn incorrect_msg_sender_for_delegate_calls_fails() { - let mut builder = PublicKernelSetupCircuitPrivateInputsBuilder::new().is_delegate_call(); - - let mut item = builder.get_call_request_item(); - // Set the msg_sender to be the caller contract. - item.call_context.msg_sender = builder.previous_kernel.contract_address; - - builder.failed_with_call_request_item(item); - } - - #[test(should_fail_with="curent contract address must not match storage contract address for delegate calls")] - fn previous_private_kernel_fails_if_incorrect_storage_contract_on_delegate_call() { - let mut builder = PublicKernelSetupCircuitPrivateInputsBuilder::new().is_delegate_call(); - - builder.public_call.contract_address = builder.public_call.storage_contract_address; - - builder.failed(); - } - #[test(should_fail_with = "incorrect storage_contract_address for call request")] fn incorrect_storage_contract_address_for_call_request_fails() { let mut builder = PublicKernelSetupCircuitPrivateInputsBuilder::new(); @@ -249,19 +218,6 @@ mod tests { builder.failed(); } - #[test(should_fail_with="incorrect storage_contract_address for delegate call request")] - fn incorrect_call_context_for_delegate_call_request_fails() { - let mut builder = PublicKernelSetupCircuitPrivateInputsBuilder::new(); - - builder.public_call.append_public_call_requests_delegate(1); - let mut call_request = builder.public_call.public_call_requests.pop(); - // Change the storage contract address to be the contract address. - call_request.item.call_context.storage_contract_address = call_request.item.contract_address; - builder.public_call.public_call_requests.push(call_request); - - builder.failed(); - } - #[test] fn public_kernel_circuit_with_private_previous_kernel_should_succeed() { let mut builder = PublicKernelSetupCircuitPrivateInputsBuilder::new(); diff --git a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_teardown.nr b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_teardown.nr index 84be93df240..1934a344362 100644 --- a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_teardown.nr +++ b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_teardown.nr @@ -75,11 +75,6 @@ mod tests { PublicKernelTeardownCircuitPrivateInputsBuilder { previous_kernel, public_call } } - pub fn is_delegate_call(&mut self) -> Self { - let _ = self.public_call.is_delegate_call(); - *self - } - pub fn execute(&mut self) -> PublicKernelCircuitPublicInputs { let public_call = self.public_call.to_public_call_data(); // Adjust the call stack item hash for the current call in the previous iteration. @@ -179,43 +174,6 @@ mod tests { builder.failed(); } - #[test] - fn delegate_call_succeeds() { - let mut builder = PublicKernelTeardownCircuitPrivateInputsBuilder::new().is_delegate_call(); - builder.succeeded(); - } - - #[test(should_fail_with="call stack item does not match item at the top of the call stack")] - fn incorrect_msg_sender_for_delegate_calls_fails() { - let mut builder = PublicKernelTeardownCircuitPrivateInputsBuilder::new().is_delegate_call(); - - let mut item = builder.get_call_request_item(); - // Set the msg_sender to be the caller contract. - item.call_context.msg_sender = builder.previous_kernel.contract_address; - - builder.failed_with_call_request_item(item); - } - - #[test(should_fail_with="call stack item does not match item at the top of the call stack")] - fn public_kernel_circuit_fails_on_incorrect_storage_contract_in_delegate_call() { - let mut builder = PublicKernelTeardownCircuitPrivateInputsBuilder::new().is_delegate_call(); - - let mut item = builder.get_call_request_item(); - // Set the storage contract address to be the contract address. - item.call_context.storage_contract_address = builder.public_call.contract_address; - - builder.failed_with_call_request_item(item); - } - - #[test(should_fail_with="curent contract address must not match storage contract address for delegate calls")] - fn previous_private_kernel_fails_if_incorrect_storage_contract_on_delegate_call() { - let mut builder = PublicKernelTeardownCircuitPrivateInputsBuilder::new().is_delegate_call(); - - builder.public_call.contract_address = builder.public_call.storage_contract_address; - - builder.failed(); - } - #[test(should_fail_with="incorrect storage_contract_address for call request")] fn incorrect_storage_contract_address_for_call_request_fails() { let mut builder = PublicKernelTeardownCircuitPrivateInputsBuilder::new(); @@ -229,19 +187,6 @@ mod tests { builder.failed(); } - #[test(should_fail_with="incorrect storage_contract_address for delegate call request")] - fn incorrect_call_context_for_delegate_call_request_fails() { - let mut builder = PublicKernelTeardownCircuitPrivateInputsBuilder::new(); - - builder.public_call.append_public_call_requests_delegate(1); - let mut call_request = builder.public_call.public_call_requests.pop(); - // Change the storage contract address to be the target contract address. - call_request.item.call_context.storage_contract_address = call_request.item.contract_address; - builder.public_call.public_call_requests.push(call_request); - - builder.failed(); - } - #[test] fn public_kernel_circuit_teardown_with_no_setup_and_no_app_logic_succeeds() { let mut builder = PublicKernelTeardownCircuitPrivateInputsBuilder::new(); diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr index 68f2ed5ea3e..7ad21602e4e 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -458,7 +458,6 @@ global AVM_EMITUNENCRYPTEDLOG_BASE_L2_GAS: u16 = 180; global AVM_SENDL2TOL1MSG_BASE_L2_GAS: u16 = 260; global AVM_CALL_BASE_L2_GAS: u16 = 450; global AVM_STATICCALL_BASE_L2_GAS: u16 = 450; -global AVM_DELEGATECALL_BASE_L2_GAS: u16 = 0; global AVM_RETURN_BASE_L2_GAS: u16 = 140; global AVM_REVERT_BASE_L2_GAS: u16 = 140; global AVM_DEBUGLOG_BASE_L2_GAS: u16 = 100; @@ -525,7 +524,6 @@ global AVM_EMITUNENCRYPTEDLOG_DYN_L2_GAS: u16 = 180; global AVM_SENDL2TOL1MSG_DYN_L2_GAS: u16 = 0; global AVM_CALL_DYN_L2_GAS: u16 = 50; global AVM_STATICCALL_DYN_L2_GAS: u16 = 50; -global AVM_DELEGATECALL_DYN_L2_GAS: u16 = 50; global AVM_RETURN_DYN_L2_GAS: u16 = 50; global AVM_REVERT_DYN_L2_GAS: u16 = 50; global AVM_DEBUGLOG_DYN_L2_GAS: u16 = 0; diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/tests/fixture_builder.nr b/noir-projects/noir-protocol-circuits/crates/types/src/tests/fixture_builder.nr index 0427e00154a..23f5a71a09f 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/tests/fixture_builder.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/tests/fixture_builder.nr @@ -955,17 +955,7 @@ impl FixtureBuilder { let index_offset = self.public_call_requests.len(); for i in 0..self.public_call_requests.max_len() { if i < num { - let item = self.mock_public_call_request_item(index_offset + i, false); - self.push_public_call_request(item); - } - } - } - - pub fn append_public_call_requests_delegate(&mut self, num: u32) { - let index_offset = self.public_call_requests.len(); - for i in 0..self.public_call_requests.max_len() { - if i < num { - let item = self.mock_public_call_request_item(index_offset + i, true); + let item = self.mock_public_call_request_item(index_offset + i); self.push_public_call_request(item); } } @@ -987,13 +977,7 @@ impl FixtureBuilder { pub fn append_public_teardown_call_request(&mut self) { let index = self.public_teardown_call_stack.len(); - let item = self.mock_public_teardown_call_request_item(index, false); - self.push_public_teardown_call_request(item); - } - - pub fn append_public_teardown_call_request_delegate(&mut self) { - let index = self.public_teardown_call_stack.len(); - let item = self.mock_public_teardown_call_request_item(index, true); + let item = self.mock_public_teardown_call_request_item(index); self.push_public_teardown_call_request(item); } @@ -1001,7 +985,7 @@ impl FixtureBuilder { let index_offset = self.public_teardown_call_stack.len(); for i in 0..self.public_teardown_call_stack.max_len() { if i < num { - let item = self.mock_public_teardown_call_request_item(index_offset + i, true); + let item = self.mock_public_teardown_call_request_item(index_offset + i); self.push_public_teardown_call_request(item); } } @@ -1095,19 +1079,19 @@ impl FixtureBuilder { PrivateCallRequest::deserialize(fields) } - fn mock_public_call_request_item(self, index: u32, is_delegate_call: bool) -> PublicCallStackItemCompressed { + fn mock_public_call_request_item(self, index: u32) -> PublicCallStackItemCompressed { let value_offset = 636363 + self.value_offset + index as Field; let mut fields = [0; PUBLIC_CALL_STACK_ITEM_COMPRESSED_LENGTH]; for i in 0..fields.len() { fields[i] = value_offset + i as Field; } let mut item = PublicCallStackItemCompressed::deserialize(fields); - item.call_context = self.generate_call_context(item.contract_address, is_delegate_call); + item.call_context = self.generate_call_context(item.contract_address, /*is_delegate_call=*/ false); item } - fn mock_public_teardown_call_request_item(self, index: u32, is_delegate_call: bool) -> PublicCallStackItemCompressed { - self.mock_public_call_request_item(index + 54345, is_delegate_call) + fn mock_public_teardown_call_request_item(self, index: u32) -> PublicCallStackItemCompressed { + self.mock_public_call_request_item(index + 54345) } fn mock_fee_payer(self) -> AztecAddress { diff --git a/yarn-project/circuits.js/src/constants.gen.ts b/yarn-project/circuits.js/src/constants.gen.ts index 9a55c2fee31..63b4925c9a8 100644 --- a/yarn-project/circuits.js/src/constants.gen.ts +++ b/yarn-project/circuits.js/src/constants.gen.ts @@ -284,7 +284,6 @@ export const AVM_EMITUNENCRYPTEDLOG_BASE_L2_GAS = 180; export const AVM_SENDL2TOL1MSG_BASE_L2_GAS = 260; export const AVM_CALL_BASE_L2_GAS = 450; export const AVM_STATICCALL_BASE_L2_GAS = 450; -export const AVM_DELEGATECALL_BASE_L2_GAS = 0; export const AVM_RETURN_BASE_L2_GAS = 140; export const AVM_REVERT_BASE_L2_GAS = 140; export const AVM_DEBUGLOG_BASE_L2_GAS = 100; @@ -350,7 +349,6 @@ export const AVM_EMITUNENCRYPTEDLOG_DYN_L2_GAS = 180; export const AVM_SENDL2TOL1MSG_DYN_L2_GAS = 0; export const AVM_CALL_DYN_L2_GAS = 50; export const AVM_STATICCALL_DYN_L2_GAS = 50; -export const AVM_DELEGATECALL_DYN_L2_GAS = 50; export const AVM_RETURN_DYN_L2_GAS = 50; export const AVM_REVERT_DYN_L2_GAS = 50; export const AVM_DEBUGLOG_DYN_L2_GAS = 0; diff --git a/yarn-project/end-to-end/src/e2e_delegate_calls/delegate.test.ts b/yarn-project/end-to-end/src/e2e_delegate_calls/delegate.test.ts index 3e7d77aeff8..f1a2ed07bf4 100644 --- a/yarn-project/end-to-end/src/e2e_delegate_calls/delegate.test.ts +++ b/yarn-project/end-to-end/src/e2e_delegate_calls/delegate.test.ts @@ -34,27 +34,5 @@ describe.skip('e2e_delegate_calls', () => { expect(delegatorValue).toEqual(sentValue); }); - - it("runs another contract's enqueued public function on delegator's storage", async () => { - const sentValue = 42n; - await delegatorContract.methods.enqueued_delegate_set_value(delegatedOnContract.address, sentValue).send().wait(); - - const delegatorValue = await delegatorContract.methods.view_public_value().simulate(); - const delegatedOnValue = await delegatedOnContract.methods.view_public_value().simulate(); - - expect(delegatedOnValue).toEqual(0n); - expect(delegatorValue).toEqual(sentValue); - }); - - it("runs another contract's public function on delegator's storage", async () => { - const sentValue = 42n; - await delegatorContract.methods.public_delegate_set_value(delegatedOnContract.address, sentValue).send().wait(); - - const delegatorValue = await delegatorContract.methods.view_public_value().simulate(); - const delegatedOnValue = await delegatedOnContract.methods.view_public_value().simulate(); - - expect(delegatedOnValue).toEqual(0n); - expect(delegatorValue).toEqual(sentValue); - }); }); }); diff --git a/yarn-project/simulator/src/acvm/oracle/oracle.ts b/yarn-project/simulator/src/acvm/oracle/oracle.ts index cab30078dc7..35d391c44f4 100644 --- a/yarn-project/simulator/src/acvm/oracle/oracle.ts +++ b/yarn-project/simulator/src/acvm/oracle/oracle.ts @@ -446,7 +446,6 @@ export class Oracle { [argsHash]: ACVMField[], [sideEffectCounter]: ACVMField[], [isStaticCall]: ACVMField[], - [isDelegateCall]: ACVMField[], ) { await this.typedOracle.enqueuePublicFunctionCall( AztecAddress.fromString(contractAddress), @@ -454,7 +453,6 @@ export class Oracle { fromACVMField(argsHash), frToNumber(fromACVMField(sideEffectCounter)), frToBoolean(fromACVMField(isStaticCall)), - frToBoolean(fromACVMField(isDelegateCall)), ); } @@ -464,7 +462,6 @@ export class Oracle { [argsHash]: ACVMField[], [sideEffectCounter]: ACVMField[], [isStaticCall]: ACVMField[], - [isDelegateCall]: ACVMField[], ) { await this.typedOracle.setPublicTeardownFunctionCall( AztecAddress.fromString(contractAddress), @@ -472,7 +469,6 @@ export class Oracle { fromACVMField(argsHash), frToNumber(fromACVMField(sideEffectCounter)), frToBoolean(fromACVMField(isStaticCall)), - frToBoolean(fromACVMField(isDelegateCall)), ); } diff --git a/yarn-project/simulator/src/acvm/oracle/typed_oracle.ts b/yarn-project/simulator/src/acvm/oracle/typed_oracle.ts index 1b9dae81e8a..98ed9fb63c6 100644 --- a/yarn-project/simulator/src/acvm/oracle/typed_oracle.ts +++ b/yarn-project/simulator/src/acvm/oracle/typed_oracle.ts @@ -253,7 +253,6 @@ export abstract class TypedOracle { _argsHash: Fr, _sideEffectCounter: number, _isStaticCall: boolean, - _isDelegateCall: boolean, ): Promise { throw new OracleMethodNotAvailableError('enqueuePublicFunctionCall'); } @@ -264,7 +263,6 @@ export abstract class TypedOracle { _argsHash: Fr, _sideEffectCounter: number, _isStaticCall: boolean, - _isDelegateCall: boolean, ): Promise { throw new OracleMethodNotAvailableError('setPublicTeardownFunctionCall'); } diff --git a/yarn-project/simulator/src/avm/avm_execution_environment.test.ts b/yarn-project/simulator/src/avm/avm_execution_environment.test.ts index e13f3f248d7..2aa4a35d2ac 100644 --- a/yarn-project/simulator/src/avm/avm_execution_environment.test.ts +++ b/yarn-project/simulator/src/avm/avm_execution_environment.test.ts @@ -23,22 +23,6 @@ describe('Execution Environment', () => { ); }); - // Delegate calls not supported. - it.skip('New delegate call should fork execution environment correctly', () => { - const executionEnvironment = initExecutionEnvironment(); - const newExecutionEnvironment = executionEnvironment.newDelegateCall(newAddress, calldata, selector); - - expect(newExecutionEnvironment).toEqual( - allSameExcept(executionEnvironment, { - address: newAddress, - contractCallDepth: Fr.ONE, - isDelegateCall: true, - // Calldata also includes AvmContextInputs - calldata: anyAvmContextInputs().concat(calldata), - }), - ); - }); - it('New static call call should fork execution environment correctly', () => { const executionEnvironment = initExecutionEnvironment(); const newExecutionEnvironment = executionEnvironment.deriveEnvironmentForNestedStaticCall( diff --git a/yarn-project/simulator/src/avm/avm_execution_environment.ts b/yarn-project/simulator/src/avm/avm_execution_environment.ts index 27a1e32ec9c..156c3b5120e 100644 --- a/yarn-project/simulator/src/avm/avm_execution_environment.ts +++ b/yarn-project/simulator/src/avm/avm_execution_environment.ts @@ -28,7 +28,6 @@ export class AvmExecutionEnvironment { public readonly header: Header, public readonly globals: GlobalVariables, public readonly isStaticCall: boolean, - public readonly isDelegateCall: boolean, public readonly calldata: Fr[], ) { // We encode some extra inputs (AvmContextInputs) in calldata. @@ -42,7 +41,6 @@ export class AvmExecutionEnvironment { calldata: Fr[], functionSelector: FunctionSelector, isStaticCall: boolean, - isDelegateCall: boolean, ) { return new AvmExecutionEnvironment( /*address=*/ targetAddress, @@ -54,7 +52,6 @@ export class AvmExecutionEnvironment { this.header, this.globals, isStaticCall, - isDelegateCall, calldata, ); } @@ -69,7 +66,6 @@ export class AvmExecutionEnvironment { calldata, functionSelector, /*isStaticCall=*/ false, - /*isDelegateCall=*/ false, ); } @@ -83,18 +79,9 @@ export class AvmExecutionEnvironment { calldata, functionSelector, /*isStaticCall=*/ true, - /*isDelegateCall=*/ false, ); } - public newDelegateCall( - _targetAddress: AztecAddress, - _calldata: Fr[], - _functionSelector: FunctionSelector, - ): AvmExecutionEnvironment { - throw new Error('Delegate calls not supported!'); - } - public getCalldataWithoutPrefix(): Fr[] { // clip off the first few entries return this.calldata.slice(AvmContextInputs.SIZE); diff --git a/yarn-project/simulator/src/avm/avm_gas.ts b/yarn-project/simulator/src/avm/avm_gas.ts index 3889a72050e..82390020d7f 100644 --- a/yarn-project/simulator/src/avm/avm_gas.ts +++ b/yarn-project/simulator/src/avm/avm_gas.ts @@ -109,7 +109,6 @@ const BaseGasCosts: Record = { [Opcode.GETCONTRACTINSTANCE]: makeCost(c.AVM_GETCONTRACTINSTANCE_BASE_L2_GAS, 0), [Opcode.CALL]: makeCost(c.AVM_CALL_BASE_L2_GAS, 0), [Opcode.STATICCALL]: makeCost(c.AVM_STATICCALL_BASE_L2_GAS, 0), - [Opcode.DELEGATECALL]: makeCost(c.AVM_DELEGATECALL_BASE_L2_GAS, 0), [Opcode.RETURN]: makeCost(c.AVM_RETURN_BASE_L2_GAS, 0), [Opcode.REVERT]: makeCost(c.AVM_REVERT_BASE_L2_GAS, 0), [Opcode.DEBUGLOG]: makeCost(c.AVM_DEBUGLOG_BASE_L2_GAS, 0), @@ -178,7 +177,6 @@ const DynamicGasCosts: Record = { [Opcode.GETCONTRACTINSTANCE]: makeCost(c.AVM_GETCONTRACTINSTANCE_DYN_L2_GAS, 0), [Opcode.CALL]: makeCost(c.AVM_CALL_DYN_L2_GAS, 0), [Opcode.STATICCALL]: makeCost(c.AVM_STATICCALL_DYN_L2_GAS, 0), - [Opcode.DELEGATECALL]: makeCost(c.AVM_DELEGATECALL_DYN_L2_GAS, 0), [Opcode.RETURN]: makeCost(c.AVM_RETURN_DYN_L2_GAS, 0), [Opcode.REVERT]: makeCost(c.AVM_REVERT_DYN_L2_GAS, 0), [Opcode.DEBUGLOG]: makeCost(c.AVM_DEBUGLOG_DYN_L2_GAS, 0), diff --git a/yarn-project/simulator/src/avm/fixtures/index.ts b/yarn-project/simulator/src/avm/fixtures/index.ts index 72bc6d66a7f..e15c820fa33 100644 --- a/yarn-project/simulator/src/avm/fixtures/index.ts +++ b/yarn-project/simulator/src/avm/fixtures/index.ts @@ -86,7 +86,6 @@ export function initExecutionEnvironment(overrides?: Partial // Control Flow - Contract Calls [Call.opcode, Call], [StaticCall.opcode, StaticCall], - //[DelegateCall.opcode, DelegateCall], [Return.opcode, Return], [Revert.opcode, Revert], diff --git a/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts b/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts index 930805fa28a..549d490c4de 100644 --- a/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts +++ b/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts @@ -66,7 +66,6 @@ export enum Opcode { // External calls CALL, STATICCALL, - DELEGATECALL, RETURN, REVERT, // Misc diff --git a/yarn-project/simulator/src/client/client_execution_context.ts b/yarn-project/simulator/src/client/client_execution_context.ts index 79b1f913ef4..27755b518a6 100644 --- a/yarn-project/simulator/src/client/client_execution_context.ts +++ b/yarn-project/simulator/src/client/client_execution_context.ts @@ -556,13 +556,12 @@ export class ClientExecutionContext extends ViewDataOracle { argsHash: Fr, sideEffectCounter: number, isStaticCall: boolean, - isDelegateCall: boolean, ) { const targetArtifact = await this.db.getFunctionArtifact(targetContractAddress, functionSelector); const derivedCallContext = this.deriveCallContext( targetContractAddress, targetArtifact, - isDelegateCall, + /*isDelegateCall=*/ false, isStaticCall, ); const args = this.packedValuesCache.unpack(argsHash); @@ -601,7 +600,6 @@ export class ClientExecutionContext extends ViewDataOracle { argsHash: Fr, sideEffectCounter: number, isStaticCall: boolean, - isDelegateCall: boolean, ) { await this.createPublicExecutionRequest( 'enqueued', @@ -610,7 +608,6 @@ export class ClientExecutionContext extends ViewDataOracle { argsHash, sideEffectCounter, isStaticCall, - isDelegateCall, ); } @@ -631,7 +628,6 @@ export class ClientExecutionContext extends ViewDataOracle { argsHash: Fr, sideEffectCounter: number, isStaticCall: boolean, - isDelegateCall: boolean, ) { await this.createPublicExecutionRequest( 'teardown', @@ -640,7 +636,6 @@ export class ClientExecutionContext extends ViewDataOracle { argsHash, sideEffectCounter, isStaticCall, - isDelegateCall, ); } diff --git a/yarn-project/simulator/src/public/executor.ts b/yarn-project/simulator/src/public/executor.ts index f3a8a13ebce..5b579d2139f 100644 --- a/yarn-project/simulator/src/public/executor.ts +++ b/yarn-project/simulator/src/public/executor.ts @@ -142,7 +142,6 @@ function createAvmExecutionEnvironment( header, globalVariables, executionRequest.callContext.isStaticCall, - executionRequest.callContext.isDelegateCall, executionRequest.args, ); } diff --git a/yarn-project/simulator/src/public/side_effect_trace.ts b/yarn-project/simulator/src/public/side_effect_trace.ts index dbbe1c8ac37..fbed487d033 100644 --- a/yarn-project/simulator/src/public/side_effect_trace.ts +++ b/yarn-project/simulator/src/public/side_effect_trace.ts @@ -329,7 +329,7 @@ function createPublicExecutionRequest(avmEnvironment: AvmExecutionEnvironment): msgSender: avmEnvironment.sender, storageContractAddress: avmEnvironment.storageAddress, functionSelector: avmEnvironment.functionSelector, - isDelegateCall: avmEnvironment.isDelegateCall, + isDelegateCall: false, isStaticCall: avmEnvironment.isStaticCall, }); return new PublicExecutionRequest( diff --git a/yarn-project/txe/src/oracle/txe_oracle.ts b/yarn-project/txe/src/oracle/txe_oracle.ts index 3d649b5e267..74fc5ed6aa7 100644 --- a/yarn-project/txe/src/oracle/txe_oracle.ts +++ b/yarn-project/txe/src/oracle/txe_oracle.ts @@ -729,7 +729,6 @@ export class TXE implements TypedOracle { functionSelector: FunctionSelector, args: Fr[], isStaticCall: boolean, - isDelegateCall: boolean, ) { // Store and modify env const currentContractAddress = AztecAddress.fromField(this.contractAddress); @@ -744,7 +743,7 @@ export class TXE implements TypedOracle { callContext.functionSelector = this.functionSelector; callContext.storageContractAddress = targetContractAddress; callContext.isStaticCall = isStaticCall; - callContext.isDelegateCall = isDelegateCall; + callContext.isDelegateCall = false; const executionResult = await this.executePublicFunction( targetContractAddress, @@ -770,7 +769,6 @@ export class TXE implements TypedOracle { argsHash: Fr, sideEffectCounter: number, isStaticCall: boolean, - isDelegateCall: boolean, ) { // Store and modify env const currentContractAddress = AztecAddress.fromField(this.contractAddress); @@ -785,7 +783,7 @@ export class TXE implements TypedOracle { callContext.functionSelector = this.functionSelector; callContext.storageContractAddress = targetContractAddress; callContext.isStaticCall = isStaticCall; - callContext.isDelegateCall = isDelegateCall; + callContext.isDelegateCall = false; const args = this.packedValuesCache.unpack(argsHash); @@ -813,7 +811,6 @@ export class TXE implements TypedOracle { argsHash: Fr, sideEffectCounter: number, isStaticCall: boolean, - isDelegateCall: boolean, ) { // Definitely not right, in that the teardown should always be last. // But useful for executing flows. @@ -823,7 +820,6 @@ export class TXE implements TypedOracle { argsHash, sideEffectCounter, isStaticCall, - isDelegateCall, ); } diff --git a/yarn-project/txe/src/txe_service/txe_service.ts b/yarn-project/txe/src/txe_service/txe_service.ts index 8b57088aade..1dc14caaf25 100644 --- a/yarn-project/txe/src/txe_service/txe_service.ts +++ b/yarn-project/txe/src/txe_service/txe_service.ts @@ -227,13 +227,7 @@ export class TXEService { ) { const parsedAddress = fromSingle(address); const parsedSelector = FunctionSelector.fromField(fromSingle(functionSelector)); - const result = await (this.typedOracle as TXE).avmOpcodeCall( - parsedAddress, - parsedSelector, - fromArray(args), - false, - false, - ); + const result = await (this.typedOracle as TXE).avmOpcodeCall(parsedAddress, parsedSelector, fromArray(args), false); if (!result.reverted) { throw new ExpectedFailureError('Public call did not revert'); } @@ -548,7 +542,6 @@ export class TXEService { FunctionSelector.fromField(fromSingle(functionSelector)), fromArray(args), /* isStaticCall */ false, - /* isDelegateCall */ false, ); return toForeignCallResult([toArray(result.returnValues), toSingle(new Fr(1))]); @@ -566,7 +559,6 @@ export class TXEService { FunctionSelector.fromField(fromSingle(functionSelector)), fromArray(args), /* isStaticCall */ true, - /* isDelegateCall */ false, ); return toForeignCallResult([toArray(result.returnValues), toSingle(new Fr(1))]); @@ -691,7 +683,6 @@ export class TXEService { argsHash: ForeignCallSingle, sideEffectCounter: ForeignCallSingle, isStaticCall: ForeignCallSingle, - isDelegateCall: ForeignCallSingle, ) { await this.typedOracle.enqueuePublicFunctionCall( fromSingle(targetContractAddress), @@ -699,7 +690,6 @@ export class TXEService { fromSingle(argsHash), fromSingle(sideEffectCounter).toNumber(), fromSingle(isStaticCall).toBool(), - fromSingle(isDelegateCall).toBool(), ); return toForeignCallResult([]); } @@ -710,7 +700,6 @@ export class TXEService { argsHash: ForeignCallSingle, sideEffectCounter: ForeignCallSingle, isStaticCall: ForeignCallSingle, - isDelegateCall: ForeignCallSingle, ) { await this.typedOracle.setPublicTeardownFunctionCall( fromSingle(targetContractAddress), @@ -718,7 +707,6 @@ export class TXEService { fromSingle(argsHash), fromSingle(sideEffectCounter).toNumber(), fromSingle(isStaticCall).toBool(), - fromSingle(isDelegateCall).toBool(), ); return toForeignCallResult([]); } From ab425e0d884fba3d80c931c4d385078c6d792e2d Mon Sep 17 00:00:00 2001 From: David Banks <47112877+dbanks12@users.noreply.github.com> Date: Wed, 4 Sep 2024 20:53:05 -0400 Subject: [PATCH 2/3] chore!: remove "storage address" opcode and field from public (#8379) --- avm-transpiler/src/opcodes.rs | 2 - avm-transpiler/src/transpile.rs | 3 +- barretenberg/cpp/pil/avm/constants_gen.pil | 1 - barretenberg/cpp/pil/avm/kernel.pil | 5 +- barretenberg/cpp/pil/avm/main.pil | 2 - .../vm/avm/generated/circuit_builder.cpp | 1 - .../barretenberg/vm/avm/generated/flavor.cpp | 1031 ++++++++--------- .../barretenberg/vm/avm/generated/flavor.hpp | 6 +- .../vm/avm/generated/full_row.cpp | 2 - .../vm/avm/generated/full_row.hpp | 3 +- .../vm/avm/generated/relations/kernel.hpp | 198 ++-- .../vm/avm/generated/relations/main.hpp | 344 +++--- .../vm/avm/tests/execution.test.cpp | 99 +- .../barretenberg/vm/avm/tests/kernel.test.cpp | 60 - .../vm/avm/trace/deserialization.cpp | 1 - .../barretenberg/vm/avm/trace/execution.cpp | 10 +- .../barretenberg/vm/avm/trace/fixed_gas.cpp | 1 - .../vm/avm/trace/kernel_trace.cpp | 14 - .../vm/avm/trace/kernel_trace.hpp | 2 - .../src/barretenberg/vm/avm/trace/opcode.cpp | 2 - .../src/barretenberg/vm/avm/trace/opcode.hpp | 1 - .../src/barretenberg/vm/avm/trace/trace.cpp | 13 - .../src/barretenberg/vm/avm/trace/trace.hpp | 1 - .../src/barretenberg/vm/aztec_constants.hpp | 3 - .../public-vm/_nested-context.md | 1 - .../protocol-specs/public-vm/avm-circuit.md | 1 - .../docs/protocol-specs/public-vm/context.mdx | 3 - .../public-vm/gen/_instruction-set.mdx | 196 ++-- .../public-vm/instruction-set.mdx | 2 +- .../protocol-specs/public-vm/nested-calls.mdx | 1 - .../protocol-specs/public-vm/type-structs.md | 1 - .../InstructionSet/InstructionSet.js | 32 +- .../src/core/libraries/ConstantsGen.sol | 1 - .../aztec/src/context/public_context.nr | 9 - .../contracts/avm_test_contract/src/main.nr | 11 +- .../crates/types/src/constants.nr | 5 - .../bb-prover/src/avm_proving.test.ts | 1 - yarn-project/circuits.js/src/constants.gen.ts | 3 - .../circuits.js/src/scripts/constants.in.ts | 2 - .../end-to-end/src/e2e_avm_simulator.test.ts | 2 +- .../simulator/src/avm/avm_context.test.ts | 2 - yarn-project/simulator/src/avm/avm_context.ts | 2 +- .../src/avm/avm_execution_environment.test.ts | 2 - .../src/avm/avm_execution_environment.ts | 2 - yarn-project/simulator/src/avm/avm_gas.ts | 2 - .../simulator/src/avm/avm_simulator.test.ts | 72 +- .../simulator/src/avm/fixtures/index.ts | 1 - .../simulator/src/avm/journal/journal.test.ts | 36 +- .../simulator/src/avm/journal/journal.ts | 62 +- .../simulator/src/avm/journal/nullifiers.ts | 50 +- .../src/avm/journal/public_storage.ts | 42 +- .../src/avm/opcodes/accrued_substate.test.ts | 36 +- .../src/avm/opcodes/accrued_substate.ts | 12 +- .../avm/opcodes/environment_getters.test.ts | 5 - .../src/avm/opcodes/environment_getters.ts | 9 - .../simulator/src/avm/opcodes/storage.test.ts | 4 +- .../simulator/src/avm/opcodes/storage.ts | 4 +- .../serialization/bytecode_serialization.ts | 2 - .../instruction_serialization.ts | 1 - yarn-project/simulator/src/public/executor.ts | 1 - .../src/public/side_effect_trace.test.ts | 4 +- .../simulator/src/public/side_effect_trace.ts | 26 +- .../src/public/side_effect_trace_interface.ts | 12 +- 63 files changed, 1084 insertions(+), 1381 deletions(-) diff --git a/avm-transpiler/src/opcodes.rs b/avm-transpiler/src/opcodes.rs index b1223ed415a..bf49e683911 100644 --- a/avm-transpiler/src/opcodes.rs +++ b/avm-transpiler/src/opcodes.rs @@ -21,7 +21,6 @@ pub enum AvmOpcode { CAST, // Execution environment ADDRESS, - STORAGEADDRESS, SENDER, FUNCTIONSELECTOR, TRANSACTIONFEE, @@ -107,7 +106,6 @@ impl AvmOpcode { // Execution Environment AvmOpcode::ADDRESS => "ADDRESS", - AvmOpcode::STORAGEADDRESS => "STORAGEADDRESS", AvmOpcode::SENDER => "SENDER", AvmOpcode::FUNCTIONSELECTOR => "FUNCTIONSELECTOR", AvmOpcode::TRANSACTIONFEE => "TRANSACTIONFEE", diff --git a/avm-transpiler/src/transpile.rs b/avm-transpiler/src/transpile.rs index db143469536..530c0400ab8 100644 --- a/avm-transpiler/src/transpile.rs +++ b/avm-transpiler/src/transpile.rs @@ -619,7 +619,7 @@ fn handle_send_l2_to_l1_msg( /// This includes: /// - Global variables /// - Caller -/// - storage address +/// - Address /// - ... fn handle_getter_instruction( avm_instrs: &mut Vec, @@ -639,7 +639,6 @@ fn handle_getter_instruction( let opcode = match function { "avmOpcodeAddress" => AvmOpcode::ADDRESS, - "avmOpcodeStorageAddress" => AvmOpcode::STORAGEADDRESS, "avmOpcodeSender" => AvmOpcode::SENDER, "avmOpcodeFeePerL2Gas" => AvmOpcode::FEEPERL2GAS, "avmOpcodeFeePerDaGas" => AvmOpcode::FEEPERDAGAS, diff --git a/barretenberg/cpp/pil/avm/constants_gen.pil b/barretenberg/cpp/pil/avm/constants_gen.pil index 9adc7a542c8..0045593552d 100644 --- a/barretenberg/cpp/pil/avm/constants_gen.pil +++ b/barretenberg/cpp/pil/avm/constants_gen.pil @@ -13,7 +13,6 @@ namespace constants(256); pol MAX_UNENCRYPTED_LOGS_PER_CALL = 4; pol SENDER_SELECTOR = 0; pol ADDRESS_SELECTOR = 1; - pol STORAGE_ADDRESS_SELECTOR = 1; pol FUNCTION_SELECTOR_SELECTOR = 2; pol START_GLOBAL_VARIABLES = 29; pol CHAIN_ID_SELECTOR = 29; diff --git a/barretenberg/cpp/pil/avm/kernel.pil b/barretenberg/cpp/pil/avm/kernel.pil index 9763bcaaa42..421ff26c028 100644 --- a/barretenberg/cpp/pil/avm/kernel.pil +++ b/barretenberg/cpp/pil/avm/kernel.pil @@ -86,9 +86,6 @@ namespace main(256); #[ADDRESS_KERNEL] sel_op_address * (kernel_in_offset - constants.ADDRESS_SELECTOR) = 0; - #[STORAGE_ADDRESS_KERNEL] - sel_op_storage_address * (kernel_in_offset - constants.STORAGE_ADDRESS_SELECTOR) = 0; - #[SENDER_KERNEL] sel_op_sender * (kernel_in_offset - constants.SENDER_SELECTOR) = 0; @@ -168,7 +165,7 @@ namespace main(256); KERNEL_OUTPUT_SELECTORS * (side_effect_counter' - (side_effect_counter + 1)) = 0; //===== LOOKUPS INTO THE PUBLIC INPUTS =========================================== - pol KERNEL_INPUT_SELECTORS = sel_op_address + sel_op_storage_address + sel_op_sender + pol KERNEL_INPUT_SELECTORS = sel_op_address + sel_op_sender + sel_op_function_selector + sel_op_transaction_fee + sel_op_chain_id + sel_op_version + sel_op_block_number + sel_op_coinbase + sel_op_timestamp + sel_op_fee_per_l2_gas + sel_op_fee_per_da_gas; diff --git a/barretenberg/cpp/pil/avm/main.pil b/barretenberg/cpp/pil/avm/main.pil index 198f6f6d8cb..2f144505796 100644 --- a/barretenberg/cpp/pil/avm/main.pil +++ b/barretenberg/cpp/pil/avm/main.pil @@ -42,7 +42,6 @@ namespace main(256); // CONTEXT - ENVIRONMENT pol commit sel_op_address; - pol commit sel_op_storage_address; pol commit sel_op_sender; pol commit sel_op_function_selector; pol commit sel_op_transaction_fee; @@ -217,7 +216,6 @@ namespace main(256); // TODO: Very likely, we can remove these constraints as the selectors should be derived during // opcode decomposition. sel_op_address * (1 - sel_op_address) = 0; - sel_op_storage_address * (1 - sel_op_storage_address) = 0; sel_op_sender * (1 - sel_op_sender) = 0; sel_op_function_selector * (1 - sel_op_function_selector) = 0; sel_op_transaction_fee * (1 - sel_op_transaction_fee) = 0; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp index 72e8e628942..871e075e50a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp @@ -252,7 +252,6 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.main_sel_op_shr[i] = rows[i].main_sel_op_shr; polys.main_sel_op_sload[i] = rows[i].main_sel_op_sload; polys.main_sel_op_sstore[i] = rows[i].main_sel_op_sstore; - polys.main_sel_op_storage_address[i] = rows[i].main_sel_op_storage_address; polys.main_sel_op_sub[i] = rows[i].main_sel_op_sub; polys.main_sel_op_timestamp[i] = rows[i].main_sel_op_timestamp; polys.main_sel_op_transaction_fee[i] = rows[i].main_sel_op_transaction_fee; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp index fca4ae3c126..6a26d0bdc02 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp @@ -233,521 +233,520 @@ AvmFlavor::AllConstRefValues::AllConstRefValues( , main_sel_op_shr(il[225]) , main_sel_op_sload(il[226]) , main_sel_op_sstore(il[227]) - , main_sel_op_storage_address(il[228]) - , main_sel_op_sub(il[229]) - , main_sel_op_timestamp(il[230]) - , main_sel_op_transaction_fee(il[231]) - , main_sel_op_version(il[232]) - , main_sel_op_xor(il[233]) - , main_sel_q_kernel_lookup(il[234]) - , main_sel_q_kernel_output_lookup(il[235]) - , main_sel_resolve_ind_addr_a(il[236]) - , main_sel_resolve_ind_addr_b(il[237]) - , main_sel_resolve_ind_addr_c(il[238]) - , main_sel_resolve_ind_addr_d(il[239]) - , main_sel_returndata(il[240]) - , main_sel_rng_16(il[241]) - , main_sel_rng_8(il[242]) - , main_sel_slice_gadget(il[243]) - , main_side_effect_counter(il[244]) - , main_sload_write_offset(il[245]) - , main_space_id(il[246]) - , main_sstore_write_offset(il[247]) - , main_tag_err(il[248]) - , main_w_in_tag(il[249]) - , mem_addr(il[250]) - , mem_clk(il[251]) - , mem_diff(il[252]) - , mem_glob_addr(il[253]) - , mem_last(il[254]) - , mem_lastAccess(il[255]) - , mem_one_min_inv(il[256]) - , mem_r_in_tag(il[257]) - , mem_rw(il[258]) - , mem_sel_mem(il[259]) - , mem_sel_mov_ia_to_ic(il[260]) - , mem_sel_mov_ib_to_ic(il[261]) - , mem_sel_op_a(il[262]) - , mem_sel_op_b(il[263]) - , mem_sel_op_c(il[264]) - , mem_sel_op_cmov(il[265]) - , mem_sel_op_d(il[266]) - , mem_sel_op_poseidon_read_a(il[267]) - , mem_sel_op_poseidon_read_b(il[268]) - , mem_sel_op_poseidon_read_c(il[269]) - , mem_sel_op_poseidon_read_d(il[270]) - , mem_sel_op_poseidon_write_a(il[271]) - , mem_sel_op_poseidon_write_b(il[272]) - , mem_sel_op_poseidon_write_c(il[273]) - , mem_sel_op_poseidon_write_d(il[274]) - , mem_sel_op_slice(il[275]) - , mem_sel_resolve_ind_addr_a(il[276]) - , mem_sel_resolve_ind_addr_b(il[277]) - , mem_sel_resolve_ind_addr_c(il[278]) - , mem_sel_resolve_ind_addr_d(il[279]) - , mem_sel_rng_chk(il[280]) - , mem_skip_check_tag(il[281]) - , mem_space_id(il[282]) - , mem_tag(il[283]) - , mem_tag_err(il[284]) - , mem_tsp(il[285]) - , mem_val(il[286]) - , mem_w_in_tag(il[287]) - , pedersen_clk(il[288]) - , pedersen_input(il[289]) - , pedersen_output(il[290]) - , pedersen_sel_pedersen(il[291]) - , poseidon2_B_10_0(il[292]) - , poseidon2_B_10_1(il[293]) - , poseidon2_B_10_2(il[294]) - , poseidon2_B_10_3(il[295]) - , poseidon2_B_11_0(il[296]) - , poseidon2_B_11_1(il[297]) - , poseidon2_B_11_2(il[298]) - , poseidon2_B_11_3(il[299]) - , poseidon2_B_12_0(il[300]) - , poseidon2_B_12_1(il[301]) - , poseidon2_B_12_2(il[302]) - , poseidon2_B_12_3(il[303]) - , poseidon2_B_13_0(il[304]) - , poseidon2_B_13_1(il[305]) - , poseidon2_B_13_2(il[306]) - , poseidon2_B_13_3(il[307]) - , poseidon2_B_14_0(il[308]) - , poseidon2_B_14_1(il[309]) - , poseidon2_B_14_2(il[310]) - , poseidon2_B_14_3(il[311]) - , poseidon2_B_15_0(il[312]) - , poseidon2_B_15_1(il[313]) - , poseidon2_B_15_2(il[314]) - , poseidon2_B_15_3(il[315]) - , poseidon2_B_16_0(il[316]) - , poseidon2_B_16_1(il[317]) - , poseidon2_B_16_2(il[318]) - , poseidon2_B_16_3(il[319]) - , poseidon2_B_17_0(il[320]) - , poseidon2_B_17_1(il[321]) - , poseidon2_B_17_2(il[322]) - , poseidon2_B_17_3(il[323]) - , poseidon2_B_18_0(il[324]) - , poseidon2_B_18_1(il[325]) - , poseidon2_B_18_2(il[326]) - , poseidon2_B_18_3(il[327]) - , poseidon2_B_19_0(il[328]) - , poseidon2_B_19_1(il[329]) - , poseidon2_B_19_2(il[330]) - , poseidon2_B_19_3(il[331]) - , poseidon2_B_20_0(il[332]) - , poseidon2_B_20_1(il[333]) - , poseidon2_B_20_2(il[334]) - , poseidon2_B_20_3(il[335]) - , poseidon2_B_21_0(il[336]) - , poseidon2_B_21_1(il[337]) - , poseidon2_B_21_2(il[338]) - , poseidon2_B_21_3(il[339]) - , poseidon2_B_22_0(il[340]) - , poseidon2_B_22_1(il[341]) - , poseidon2_B_22_2(il[342]) - , poseidon2_B_22_3(il[343]) - , poseidon2_B_23_0(il[344]) - , poseidon2_B_23_1(il[345]) - , poseidon2_B_23_2(il[346]) - , poseidon2_B_23_3(il[347]) - , poseidon2_B_24_0(il[348]) - , poseidon2_B_24_1(il[349]) - , poseidon2_B_24_2(il[350]) - , poseidon2_B_24_3(il[351]) - , poseidon2_B_25_0(il[352]) - , poseidon2_B_25_1(il[353]) - , poseidon2_B_25_2(il[354]) - , poseidon2_B_25_3(il[355]) - , poseidon2_B_26_0(il[356]) - , poseidon2_B_26_1(il[357]) - , poseidon2_B_26_2(il[358]) - , poseidon2_B_26_3(il[359]) - , poseidon2_B_27_0(il[360]) - , poseidon2_B_27_1(il[361]) - , poseidon2_B_27_2(il[362]) - , poseidon2_B_27_3(il[363]) - , poseidon2_B_28_0(il[364]) - , poseidon2_B_28_1(il[365]) - , poseidon2_B_28_2(il[366]) - , poseidon2_B_28_3(il[367]) - , poseidon2_B_29_0(il[368]) - , poseidon2_B_29_1(il[369]) - , poseidon2_B_29_2(il[370]) - , poseidon2_B_29_3(il[371]) - , poseidon2_B_30_0(il[372]) - , poseidon2_B_30_1(il[373]) - , poseidon2_B_30_2(il[374]) - , poseidon2_B_30_3(il[375]) - , poseidon2_B_31_0(il[376]) - , poseidon2_B_31_1(il[377]) - , poseidon2_B_31_2(il[378]) - , poseidon2_B_31_3(il[379]) - , poseidon2_B_32_0(il[380]) - , poseidon2_B_32_1(il[381]) - , poseidon2_B_32_2(il[382]) - , poseidon2_B_32_3(il[383]) - , poseidon2_B_33_0(il[384]) - , poseidon2_B_33_1(il[385]) - , poseidon2_B_33_2(il[386]) - , poseidon2_B_33_3(il[387]) - , poseidon2_B_34_0(il[388]) - , poseidon2_B_34_1(il[389]) - , poseidon2_B_34_2(il[390]) - , poseidon2_B_34_3(il[391]) - , poseidon2_B_35_0(il[392]) - , poseidon2_B_35_1(il[393]) - , poseidon2_B_35_2(il[394]) - , poseidon2_B_35_3(il[395]) - , poseidon2_B_36_0(il[396]) - , poseidon2_B_36_1(il[397]) - , poseidon2_B_36_2(il[398]) - , poseidon2_B_36_3(il[399]) - , poseidon2_B_37_0(il[400]) - , poseidon2_B_37_1(il[401]) - , poseidon2_B_37_2(il[402]) - , poseidon2_B_37_3(il[403]) - , poseidon2_B_38_0(il[404]) - , poseidon2_B_38_1(il[405]) - , poseidon2_B_38_2(il[406]) - , poseidon2_B_38_3(il[407]) - , poseidon2_B_39_0(il[408]) - , poseidon2_B_39_1(il[409]) - , poseidon2_B_39_2(il[410]) - , poseidon2_B_39_3(il[411]) - , poseidon2_B_40_0(il[412]) - , poseidon2_B_40_1(il[413]) - , poseidon2_B_40_2(il[414]) - , poseidon2_B_40_3(il[415]) - , poseidon2_B_41_0(il[416]) - , poseidon2_B_41_1(il[417]) - , poseidon2_B_41_2(il[418]) - , poseidon2_B_41_3(il[419]) - , poseidon2_B_42_0(il[420]) - , poseidon2_B_42_1(il[421]) - , poseidon2_B_42_2(il[422]) - , poseidon2_B_42_3(il[423]) - , poseidon2_B_43_0(il[424]) - , poseidon2_B_43_1(il[425]) - , poseidon2_B_43_2(il[426]) - , poseidon2_B_43_3(il[427]) - , poseidon2_B_44_0(il[428]) - , poseidon2_B_44_1(il[429]) - , poseidon2_B_44_2(il[430]) - , poseidon2_B_44_3(il[431]) - , poseidon2_B_45_0(il[432]) - , poseidon2_B_45_1(il[433]) - , poseidon2_B_45_2(il[434]) - , poseidon2_B_45_3(il[435]) - , poseidon2_B_46_0(il[436]) - , poseidon2_B_46_1(il[437]) - , poseidon2_B_46_2(il[438]) - , poseidon2_B_46_3(il[439]) - , poseidon2_B_47_0(il[440]) - , poseidon2_B_47_1(il[441]) - , poseidon2_B_47_2(il[442]) - , poseidon2_B_47_3(il[443]) - , poseidon2_B_48_0(il[444]) - , poseidon2_B_48_1(il[445]) - , poseidon2_B_48_2(il[446]) - , poseidon2_B_48_3(il[447]) - , poseidon2_B_49_0(il[448]) - , poseidon2_B_49_1(il[449]) - , poseidon2_B_49_2(il[450]) - , poseidon2_B_49_3(il[451]) - , poseidon2_B_4_0(il[452]) - , poseidon2_B_4_1(il[453]) - , poseidon2_B_4_2(il[454]) - , poseidon2_B_4_3(il[455]) - , poseidon2_B_50_0(il[456]) - , poseidon2_B_50_1(il[457]) - , poseidon2_B_50_2(il[458]) - , poseidon2_B_50_3(il[459]) - , poseidon2_B_51_0(il[460]) - , poseidon2_B_51_1(il[461]) - , poseidon2_B_51_2(il[462]) - , poseidon2_B_51_3(il[463]) - , poseidon2_B_52_0(il[464]) - , poseidon2_B_52_1(il[465]) - , poseidon2_B_52_2(il[466]) - , poseidon2_B_52_3(il[467]) - , poseidon2_B_53_0(il[468]) - , poseidon2_B_53_1(il[469]) - , poseidon2_B_53_2(il[470]) - , poseidon2_B_53_3(il[471]) - , poseidon2_B_54_0(il[472]) - , poseidon2_B_54_1(il[473]) - , poseidon2_B_54_2(il[474]) - , poseidon2_B_54_3(il[475]) - , poseidon2_B_55_0(il[476]) - , poseidon2_B_55_1(il[477]) - , poseidon2_B_55_2(il[478]) - , poseidon2_B_55_3(il[479]) - , poseidon2_B_56_0(il[480]) - , poseidon2_B_56_1(il[481]) - , poseidon2_B_56_2(il[482]) - , poseidon2_B_56_3(il[483]) - , poseidon2_B_57_0(il[484]) - , poseidon2_B_57_1(il[485]) - , poseidon2_B_57_2(il[486]) - , poseidon2_B_57_3(il[487]) - , poseidon2_B_58_0(il[488]) - , poseidon2_B_58_1(il[489]) - , poseidon2_B_58_2(il[490]) - , poseidon2_B_58_3(il[491]) - , poseidon2_B_59_0(il[492]) - , poseidon2_B_59_1(il[493]) - , poseidon2_B_59_2(il[494]) - , poseidon2_B_59_3(il[495]) - , poseidon2_B_5_0(il[496]) - , poseidon2_B_5_1(il[497]) - , poseidon2_B_5_2(il[498]) - , poseidon2_B_5_3(il[499]) - , poseidon2_B_6_0(il[500]) - , poseidon2_B_6_1(il[501]) - , poseidon2_B_6_2(il[502]) - , poseidon2_B_6_3(il[503]) - , poseidon2_B_7_0(il[504]) - , poseidon2_B_7_1(il[505]) - , poseidon2_B_7_2(il[506]) - , poseidon2_B_7_3(il[507]) - , poseidon2_B_8_0(il[508]) - , poseidon2_B_8_1(il[509]) - , poseidon2_B_8_2(il[510]) - , poseidon2_B_8_3(il[511]) - , poseidon2_B_9_0(il[512]) - , poseidon2_B_9_1(il[513]) - , poseidon2_B_9_2(il[514]) - , poseidon2_B_9_3(il[515]) - , poseidon2_EXT_LAYER_4(il[516]) - , poseidon2_EXT_LAYER_5(il[517]) - , poseidon2_EXT_LAYER_6(il[518]) - , poseidon2_EXT_LAYER_7(il[519]) - , poseidon2_T_0_4(il[520]) - , poseidon2_T_0_5(il[521]) - , poseidon2_T_0_6(il[522]) - , poseidon2_T_0_7(il[523]) - , poseidon2_T_1_4(il[524]) - , poseidon2_T_1_5(il[525]) - , poseidon2_T_1_6(il[526]) - , poseidon2_T_1_7(il[527]) - , poseidon2_T_2_4(il[528]) - , poseidon2_T_2_5(il[529]) - , poseidon2_T_2_6(il[530]) - , poseidon2_T_2_7(il[531]) - , poseidon2_T_3_4(il[532]) - , poseidon2_T_3_5(il[533]) - , poseidon2_T_3_6(il[534]) - , poseidon2_T_3_7(il[535]) - , poseidon2_T_60_4(il[536]) - , poseidon2_T_60_5(il[537]) - , poseidon2_T_60_6(il[538]) - , poseidon2_T_60_7(il[539]) - , poseidon2_T_61_4(il[540]) - , poseidon2_T_61_5(il[541]) - , poseidon2_T_61_6(il[542]) - , poseidon2_T_61_7(il[543]) - , poseidon2_T_62_4(il[544]) - , poseidon2_T_62_5(il[545]) - , poseidon2_T_62_6(il[546]) - , poseidon2_T_62_7(il[547]) - , poseidon2_T_63_4(il[548]) - , poseidon2_T_63_5(il[549]) - , poseidon2_T_63_6(il[550]) - , poseidon2_T_63_7(il[551]) - , poseidon2_a_0(il[552]) - , poseidon2_a_1(il[553]) - , poseidon2_a_2(il[554]) - , poseidon2_a_3(il[555]) - , poseidon2_b_0(il[556]) - , poseidon2_b_1(il[557]) - , poseidon2_b_2(il[558]) - , poseidon2_b_3(il[559]) - , poseidon2_clk(il[560]) - , poseidon2_input_addr(il[561]) - , poseidon2_mem_addr_read_a(il[562]) - , poseidon2_mem_addr_read_b(il[563]) - , poseidon2_mem_addr_read_c(il[564]) - , poseidon2_mem_addr_read_d(il[565]) - , poseidon2_mem_addr_write_a(il[566]) - , poseidon2_mem_addr_write_b(il[567]) - , poseidon2_mem_addr_write_c(il[568]) - , poseidon2_mem_addr_write_d(il[569]) - , poseidon2_output_addr(il[570]) - , poseidon2_sel_poseidon_perm(il[571]) - , range_check_alu_rng_chk(il[572]) - , range_check_clk(il[573]) - , range_check_cmp_hi_bits_rng_chk(il[574]) - , range_check_cmp_lo_bits_rng_chk(il[575]) - , range_check_dyn_diff(il[576]) - , range_check_dyn_rng_chk_bits(il[577]) - , range_check_dyn_rng_chk_pow_2(il[578]) - , range_check_gas_da_rng_chk(il[579]) - , range_check_gas_l2_rng_chk(il[580]) - , range_check_is_lte_u112(il[581]) - , range_check_is_lte_u128(il[582]) - , range_check_is_lte_u16(il[583]) - , range_check_is_lte_u32(il[584]) - , range_check_is_lte_u48(il[585]) - , range_check_is_lte_u64(il[586]) - , range_check_is_lte_u80(il[587]) - , range_check_is_lte_u96(il[588]) - , range_check_mem_rng_chk(il[589]) - , range_check_rng_chk_bits(il[590]) - , range_check_sel_lookup_0(il[591]) - , range_check_sel_lookup_1(il[592]) - , range_check_sel_lookup_2(il[593]) - , range_check_sel_lookup_3(il[594]) - , range_check_sel_lookup_4(il[595]) - , range_check_sel_lookup_5(il[596]) - , range_check_sel_lookup_6(il[597]) - , range_check_sel_rng_chk(il[598]) - , range_check_u16_r0(il[599]) - , range_check_u16_r1(il[600]) - , range_check_u16_r2(il[601]) - , range_check_u16_r3(il[602]) - , range_check_u16_r4(il[603]) - , range_check_u16_r5(il[604]) - , range_check_u16_r6(il[605]) - , range_check_u16_r7(il[606]) - , range_check_value(il[607]) - , sha256_clk(il[608]) - , sha256_input(il[609]) - , sha256_output(il[610]) - , sha256_sel_sha256_compression(il[611]) - , sha256_state(il[612]) - , slice_addr(il[613]) - , slice_clk(il[614]) - , slice_cnt(il[615]) - , slice_col_offset(il[616]) - , slice_one_min_inv(il[617]) - , slice_sel_cd_cpy(il[618]) - , slice_sel_mem_active(il[619]) - , slice_sel_return(il[620]) - , slice_sel_start(il[621]) - , slice_space_id(il[622]) - , slice_val(il[623]) - , lookup_rng_chk_pow_2_counts(il[624]) - , lookup_rng_chk_diff_counts(il[625]) - , lookup_rng_chk_0_counts(il[626]) - , lookup_rng_chk_1_counts(il[627]) - , lookup_rng_chk_2_counts(il[628]) - , lookup_rng_chk_3_counts(il[629]) - , lookup_rng_chk_4_counts(il[630]) - , lookup_rng_chk_5_counts(il[631]) - , lookup_rng_chk_6_counts(il[632]) - , lookup_rng_chk_7_counts(il[633]) - , lookup_pow_2_0_counts(il[634]) - , lookup_pow_2_1_counts(il[635]) - , lookup_byte_lengths_counts(il[636]) - , lookup_byte_operations_counts(il[637]) - , lookup_opcode_gas_counts(il[638]) - , kernel_output_lookup_counts(il[639]) - , lookup_into_kernel_counts(il[640]) - , lookup_cd_value_counts(il[641]) - , lookup_ret_value_counts(il[642]) - , incl_main_tag_err_counts(il[643]) - , incl_mem_tag_err_counts(il[644]) - , perm_rng_mem_inv(il[645]) - , perm_rng_cmp_lo_inv(il[646]) - , perm_rng_cmp_hi_inv(il[647]) - , perm_rng_alu_inv(il[648]) - , perm_cmp_alu_inv(il[649]) - , perm_rng_gas_l2_inv(il[650]) - , perm_rng_gas_da_inv(il[651]) - , perm_pos_mem_read_a_inv(il[652]) - , perm_pos_mem_read_b_inv(il[653]) - , perm_pos_mem_read_c_inv(il[654]) - , perm_pos_mem_read_d_inv(il[655]) - , perm_pos_mem_write_a_inv(il[656]) - , perm_pos_mem_write_b_inv(il[657]) - , perm_pos_mem_write_c_inv(il[658]) - , perm_pos_mem_write_d_inv(il[659]) - , perm_slice_mem_inv(il[660]) - , perm_main_alu_inv(il[661]) - , perm_main_bin_inv(il[662]) - , perm_main_conv_inv(il[663]) - , perm_main_pos2_perm_inv(il[664]) - , perm_main_pedersen_inv(il[665]) - , perm_main_slice_inv(il[666]) - , perm_main_mem_a_inv(il[667]) - , perm_main_mem_b_inv(il[668]) - , perm_main_mem_c_inv(il[669]) - , perm_main_mem_d_inv(il[670]) - , perm_main_mem_ind_addr_a_inv(il[671]) - , perm_main_mem_ind_addr_b_inv(il[672]) - , perm_main_mem_ind_addr_c_inv(il[673]) - , perm_main_mem_ind_addr_d_inv(il[674]) - , lookup_rng_chk_pow_2_inv(il[675]) - , lookup_rng_chk_diff_inv(il[676]) - , lookup_rng_chk_0_inv(il[677]) - , lookup_rng_chk_1_inv(il[678]) - , lookup_rng_chk_2_inv(il[679]) - , lookup_rng_chk_3_inv(il[680]) - , lookup_rng_chk_4_inv(il[681]) - , lookup_rng_chk_5_inv(il[682]) - , lookup_rng_chk_6_inv(il[683]) - , lookup_rng_chk_7_inv(il[684]) - , lookup_pow_2_0_inv(il[685]) - , lookup_pow_2_1_inv(il[686]) - , lookup_byte_lengths_inv(il[687]) - , lookup_byte_operations_inv(il[688]) - , lookup_opcode_gas_inv(il[689]) - , kernel_output_lookup_inv(il[690]) - , lookup_into_kernel_inv(il[691]) - , lookup_cd_value_inv(il[692]) - , lookup_ret_value_inv(il[693]) - , incl_main_tag_err_inv(il[694]) - , incl_mem_tag_err_inv(il[695]) - , binary_acc_ia_shift(il[696]) - , binary_acc_ib_shift(il[697]) - , binary_acc_ic_shift(il[698]) - , binary_mem_tag_ctr_shift(il[699]) - , binary_op_id_shift(il[700]) - , cmp_a_hi_shift(il[701]) - , cmp_a_lo_shift(il[702]) - , cmp_b_hi_shift(il[703]) - , cmp_b_lo_shift(il[704]) - , cmp_cmp_rng_ctr_shift(il[705]) - , cmp_op_gt_shift(il[706]) - , cmp_p_sub_a_hi_shift(il[707]) - , cmp_p_sub_a_lo_shift(il[708]) - , cmp_p_sub_b_hi_shift(il[709]) - , cmp_p_sub_b_lo_shift(il[710]) - , cmp_sel_rng_chk_shift(il[711]) - , main_da_gas_remaining_shift(il[712]) - , main_emit_l2_to_l1_msg_write_offset_shift(il[713]) - , main_emit_note_hash_write_offset_shift(il[714]) - , main_emit_nullifier_write_offset_shift(il[715]) - , main_emit_unencrypted_log_write_offset_shift(il[716]) - , main_internal_return_ptr_shift(il[717]) - , main_l1_to_l2_msg_exists_write_offset_shift(il[718]) - , main_l2_gas_remaining_shift(il[719]) - , main_note_hash_exist_write_offset_shift(il[720]) - , main_nullifier_exists_write_offset_shift(il[721]) - , main_nullifier_non_exists_write_offset_shift(il[722]) - , main_pc_shift(il[723]) - , main_sel_execution_row_shift(il[724]) - , main_side_effect_counter_shift(il[725]) - , main_sload_write_offset_shift(il[726]) - , main_sstore_write_offset_shift(il[727]) - , mem_glob_addr_shift(il[728]) - , mem_rw_shift(il[729]) - , mem_sel_mem_shift(il[730]) - , mem_tag_shift(il[731]) - , mem_tsp_shift(il[732]) - , mem_val_shift(il[733]) - , slice_addr_shift(il[734]) - , slice_clk_shift(il[735]) - , slice_cnt_shift(il[736]) - , slice_col_offset_shift(il[737]) - , slice_sel_cd_cpy_shift(il[738]) - , slice_sel_mem_active_shift(il[739]) - , slice_sel_return_shift(il[740]) - , slice_sel_start_shift(il[741]) - , slice_space_id_shift(il[742]) + , main_sel_op_sub(il[228]) + , main_sel_op_timestamp(il[229]) + , main_sel_op_transaction_fee(il[230]) + , main_sel_op_version(il[231]) + , main_sel_op_xor(il[232]) + , main_sel_q_kernel_lookup(il[233]) + , main_sel_q_kernel_output_lookup(il[234]) + , main_sel_resolve_ind_addr_a(il[235]) + , main_sel_resolve_ind_addr_b(il[236]) + , main_sel_resolve_ind_addr_c(il[237]) + , main_sel_resolve_ind_addr_d(il[238]) + , main_sel_returndata(il[239]) + , main_sel_rng_16(il[240]) + , main_sel_rng_8(il[241]) + , main_sel_slice_gadget(il[242]) + , main_side_effect_counter(il[243]) + , main_sload_write_offset(il[244]) + , main_space_id(il[245]) + , main_sstore_write_offset(il[246]) + , main_tag_err(il[247]) + , main_w_in_tag(il[248]) + , mem_addr(il[249]) + , mem_clk(il[250]) + , mem_diff(il[251]) + , mem_glob_addr(il[252]) + , mem_last(il[253]) + , mem_lastAccess(il[254]) + , mem_one_min_inv(il[255]) + , mem_r_in_tag(il[256]) + , mem_rw(il[257]) + , mem_sel_mem(il[258]) + , mem_sel_mov_ia_to_ic(il[259]) + , mem_sel_mov_ib_to_ic(il[260]) + , mem_sel_op_a(il[261]) + , mem_sel_op_b(il[262]) + , mem_sel_op_c(il[263]) + , mem_sel_op_cmov(il[264]) + , mem_sel_op_d(il[265]) + , mem_sel_op_poseidon_read_a(il[266]) + , mem_sel_op_poseidon_read_b(il[267]) + , mem_sel_op_poseidon_read_c(il[268]) + , mem_sel_op_poseidon_read_d(il[269]) + , mem_sel_op_poseidon_write_a(il[270]) + , mem_sel_op_poseidon_write_b(il[271]) + , mem_sel_op_poseidon_write_c(il[272]) + , mem_sel_op_poseidon_write_d(il[273]) + , mem_sel_op_slice(il[274]) + , mem_sel_resolve_ind_addr_a(il[275]) + , mem_sel_resolve_ind_addr_b(il[276]) + , mem_sel_resolve_ind_addr_c(il[277]) + , mem_sel_resolve_ind_addr_d(il[278]) + , mem_sel_rng_chk(il[279]) + , mem_skip_check_tag(il[280]) + , mem_space_id(il[281]) + , mem_tag(il[282]) + , mem_tag_err(il[283]) + , mem_tsp(il[284]) + , mem_val(il[285]) + , mem_w_in_tag(il[286]) + , pedersen_clk(il[287]) + , pedersen_input(il[288]) + , pedersen_output(il[289]) + , pedersen_sel_pedersen(il[290]) + , poseidon2_B_10_0(il[291]) + , poseidon2_B_10_1(il[292]) + , poseidon2_B_10_2(il[293]) + , poseidon2_B_10_3(il[294]) + , poseidon2_B_11_0(il[295]) + , poseidon2_B_11_1(il[296]) + , poseidon2_B_11_2(il[297]) + , poseidon2_B_11_3(il[298]) + , poseidon2_B_12_0(il[299]) + , poseidon2_B_12_1(il[300]) + , poseidon2_B_12_2(il[301]) + , poseidon2_B_12_3(il[302]) + , poseidon2_B_13_0(il[303]) + , poseidon2_B_13_1(il[304]) + , poseidon2_B_13_2(il[305]) + , poseidon2_B_13_3(il[306]) + , poseidon2_B_14_0(il[307]) + , poseidon2_B_14_1(il[308]) + , poseidon2_B_14_2(il[309]) + , poseidon2_B_14_3(il[310]) + , poseidon2_B_15_0(il[311]) + , poseidon2_B_15_1(il[312]) + , poseidon2_B_15_2(il[313]) + , poseidon2_B_15_3(il[314]) + , poseidon2_B_16_0(il[315]) + , poseidon2_B_16_1(il[316]) + , poseidon2_B_16_2(il[317]) + , poseidon2_B_16_3(il[318]) + , poseidon2_B_17_0(il[319]) + , poseidon2_B_17_1(il[320]) + , poseidon2_B_17_2(il[321]) + , poseidon2_B_17_3(il[322]) + , poseidon2_B_18_0(il[323]) + , poseidon2_B_18_1(il[324]) + , poseidon2_B_18_2(il[325]) + , poseidon2_B_18_3(il[326]) + , poseidon2_B_19_0(il[327]) + , poseidon2_B_19_1(il[328]) + , poseidon2_B_19_2(il[329]) + , poseidon2_B_19_3(il[330]) + , poseidon2_B_20_0(il[331]) + , poseidon2_B_20_1(il[332]) + , poseidon2_B_20_2(il[333]) + , poseidon2_B_20_3(il[334]) + , poseidon2_B_21_0(il[335]) + , poseidon2_B_21_1(il[336]) + , poseidon2_B_21_2(il[337]) + , poseidon2_B_21_3(il[338]) + , poseidon2_B_22_0(il[339]) + , poseidon2_B_22_1(il[340]) + , poseidon2_B_22_2(il[341]) + , poseidon2_B_22_3(il[342]) + , poseidon2_B_23_0(il[343]) + , poseidon2_B_23_1(il[344]) + , poseidon2_B_23_2(il[345]) + , poseidon2_B_23_3(il[346]) + , poseidon2_B_24_0(il[347]) + , poseidon2_B_24_1(il[348]) + , poseidon2_B_24_2(il[349]) + , poseidon2_B_24_3(il[350]) + , poseidon2_B_25_0(il[351]) + , poseidon2_B_25_1(il[352]) + , poseidon2_B_25_2(il[353]) + , poseidon2_B_25_3(il[354]) + , poseidon2_B_26_0(il[355]) + , poseidon2_B_26_1(il[356]) + , poseidon2_B_26_2(il[357]) + , poseidon2_B_26_3(il[358]) + , poseidon2_B_27_0(il[359]) + , poseidon2_B_27_1(il[360]) + , poseidon2_B_27_2(il[361]) + , poseidon2_B_27_3(il[362]) + , poseidon2_B_28_0(il[363]) + , poseidon2_B_28_1(il[364]) + , poseidon2_B_28_2(il[365]) + , poseidon2_B_28_3(il[366]) + , poseidon2_B_29_0(il[367]) + , poseidon2_B_29_1(il[368]) + , poseidon2_B_29_2(il[369]) + , poseidon2_B_29_3(il[370]) + , poseidon2_B_30_0(il[371]) + , poseidon2_B_30_1(il[372]) + , poseidon2_B_30_2(il[373]) + , poseidon2_B_30_3(il[374]) + , poseidon2_B_31_0(il[375]) + , poseidon2_B_31_1(il[376]) + , poseidon2_B_31_2(il[377]) + , poseidon2_B_31_3(il[378]) + , poseidon2_B_32_0(il[379]) + , poseidon2_B_32_1(il[380]) + , poseidon2_B_32_2(il[381]) + , poseidon2_B_32_3(il[382]) + , poseidon2_B_33_0(il[383]) + , poseidon2_B_33_1(il[384]) + , poseidon2_B_33_2(il[385]) + , poseidon2_B_33_3(il[386]) + , poseidon2_B_34_0(il[387]) + , poseidon2_B_34_1(il[388]) + , poseidon2_B_34_2(il[389]) + , poseidon2_B_34_3(il[390]) + , poseidon2_B_35_0(il[391]) + , poseidon2_B_35_1(il[392]) + , poseidon2_B_35_2(il[393]) + , poseidon2_B_35_3(il[394]) + , poseidon2_B_36_0(il[395]) + , poseidon2_B_36_1(il[396]) + , poseidon2_B_36_2(il[397]) + , poseidon2_B_36_3(il[398]) + , poseidon2_B_37_0(il[399]) + , poseidon2_B_37_1(il[400]) + , poseidon2_B_37_2(il[401]) + , poseidon2_B_37_3(il[402]) + , poseidon2_B_38_0(il[403]) + , poseidon2_B_38_1(il[404]) + , poseidon2_B_38_2(il[405]) + , poseidon2_B_38_3(il[406]) + , poseidon2_B_39_0(il[407]) + , poseidon2_B_39_1(il[408]) + , poseidon2_B_39_2(il[409]) + , poseidon2_B_39_3(il[410]) + , poseidon2_B_40_0(il[411]) + , poseidon2_B_40_1(il[412]) + , poseidon2_B_40_2(il[413]) + , poseidon2_B_40_3(il[414]) + , poseidon2_B_41_0(il[415]) + , poseidon2_B_41_1(il[416]) + , poseidon2_B_41_2(il[417]) + , poseidon2_B_41_3(il[418]) + , poseidon2_B_42_0(il[419]) + , poseidon2_B_42_1(il[420]) + , poseidon2_B_42_2(il[421]) + , poseidon2_B_42_3(il[422]) + , poseidon2_B_43_0(il[423]) + , poseidon2_B_43_1(il[424]) + , poseidon2_B_43_2(il[425]) + , poseidon2_B_43_3(il[426]) + , poseidon2_B_44_0(il[427]) + , poseidon2_B_44_1(il[428]) + , poseidon2_B_44_2(il[429]) + , poseidon2_B_44_3(il[430]) + , poseidon2_B_45_0(il[431]) + , poseidon2_B_45_1(il[432]) + , poseidon2_B_45_2(il[433]) + , poseidon2_B_45_3(il[434]) + , poseidon2_B_46_0(il[435]) + , poseidon2_B_46_1(il[436]) + , poseidon2_B_46_2(il[437]) + , poseidon2_B_46_3(il[438]) + , poseidon2_B_47_0(il[439]) + , poseidon2_B_47_1(il[440]) + , poseidon2_B_47_2(il[441]) + , poseidon2_B_47_3(il[442]) + , poseidon2_B_48_0(il[443]) + , poseidon2_B_48_1(il[444]) + , poseidon2_B_48_2(il[445]) + , poseidon2_B_48_3(il[446]) + , poseidon2_B_49_0(il[447]) + , poseidon2_B_49_1(il[448]) + , poseidon2_B_49_2(il[449]) + , poseidon2_B_49_3(il[450]) + , poseidon2_B_4_0(il[451]) + , poseidon2_B_4_1(il[452]) + , poseidon2_B_4_2(il[453]) + , poseidon2_B_4_3(il[454]) + , poseidon2_B_50_0(il[455]) + , poseidon2_B_50_1(il[456]) + , poseidon2_B_50_2(il[457]) + , poseidon2_B_50_3(il[458]) + , poseidon2_B_51_0(il[459]) + , poseidon2_B_51_1(il[460]) + , poseidon2_B_51_2(il[461]) + , poseidon2_B_51_3(il[462]) + , poseidon2_B_52_0(il[463]) + , poseidon2_B_52_1(il[464]) + , poseidon2_B_52_2(il[465]) + , poseidon2_B_52_3(il[466]) + , poseidon2_B_53_0(il[467]) + , poseidon2_B_53_1(il[468]) + , poseidon2_B_53_2(il[469]) + , poseidon2_B_53_3(il[470]) + , poseidon2_B_54_0(il[471]) + , poseidon2_B_54_1(il[472]) + , poseidon2_B_54_2(il[473]) + , poseidon2_B_54_3(il[474]) + , poseidon2_B_55_0(il[475]) + , poseidon2_B_55_1(il[476]) + , poseidon2_B_55_2(il[477]) + , poseidon2_B_55_3(il[478]) + , poseidon2_B_56_0(il[479]) + , poseidon2_B_56_1(il[480]) + , poseidon2_B_56_2(il[481]) + , poseidon2_B_56_3(il[482]) + , poseidon2_B_57_0(il[483]) + , poseidon2_B_57_1(il[484]) + , poseidon2_B_57_2(il[485]) + , poseidon2_B_57_3(il[486]) + , poseidon2_B_58_0(il[487]) + , poseidon2_B_58_1(il[488]) + , poseidon2_B_58_2(il[489]) + , poseidon2_B_58_3(il[490]) + , poseidon2_B_59_0(il[491]) + , poseidon2_B_59_1(il[492]) + , poseidon2_B_59_2(il[493]) + , poseidon2_B_59_3(il[494]) + , poseidon2_B_5_0(il[495]) + , poseidon2_B_5_1(il[496]) + , poseidon2_B_5_2(il[497]) + , poseidon2_B_5_3(il[498]) + , poseidon2_B_6_0(il[499]) + , poseidon2_B_6_1(il[500]) + , poseidon2_B_6_2(il[501]) + , poseidon2_B_6_3(il[502]) + , poseidon2_B_7_0(il[503]) + , poseidon2_B_7_1(il[504]) + , poseidon2_B_7_2(il[505]) + , poseidon2_B_7_3(il[506]) + , poseidon2_B_8_0(il[507]) + , poseidon2_B_8_1(il[508]) + , poseidon2_B_8_2(il[509]) + , poseidon2_B_8_3(il[510]) + , poseidon2_B_9_0(il[511]) + , poseidon2_B_9_1(il[512]) + , poseidon2_B_9_2(il[513]) + , poseidon2_B_9_3(il[514]) + , poseidon2_EXT_LAYER_4(il[515]) + , poseidon2_EXT_LAYER_5(il[516]) + , poseidon2_EXT_LAYER_6(il[517]) + , poseidon2_EXT_LAYER_7(il[518]) + , poseidon2_T_0_4(il[519]) + , poseidon2_T_0_5(il[520]) + , poseidon2_T_0_6(il[521]) + , poseidon2_T_0_7(il[522]) + , poseidon2_T_1_4(il[523]) + , poseidon2_T_1_5(il[524]) + , poseidon2_T_1_6(il[525]) + , poseidon2_T_1_7(il[526]) + , poseidon2_T_2_4(il[527]) + , poseidon2_T_2_5(il[528]) + , poseidon2_T_2_6(il[529]) + , poseidon2_T_2_7(il[530]) + , poseidon2_T_3_4(il[531]) + , poseidon2_T_3_5(il[532]) + , poseidon2_T_3_6(il[533]) + , poseidon2_T_3_7(il[534]) + , poseidon2_T_60_4(il[535]) + , poseidon2_T_60_5(il[536]) + , poseidon2_T_60_6(il[537]) + , poseidon2_T_60_7(il[538]) + , poseidon2_T_61_4(il[539]) + , poseidon2_T_61_5(il[540]) + , poseidon2_T_61_6(il[541]) + , poseidon2_T_61_7(il[542]) + , poseidon2_T_62_4(il[543]) + , poseidon2_T_62_5(il[544]) + , poseidon2_T_62_6(il[545]) + , poseidon2_T_62_7(il[546]) + , poseidon2_T_63_4(il[547]) + , poseidon2_T_63_5(il[548]) + , poseidon2_T_63_6(il[549]) + , poseidon2_T_63_7(il[550]) + , poseidon2_a_0(il[551]) + , poseidon2_a_1(il[552]) + , poseidon2_a_2(il[553]) + , poseidon2_a_3(il[554]) + , poseidon2_b_0(il[555]) + , poseidon2_b_1(il[556]) + , poseidon2_b_2(il[557]) + , poseidon2_b_3(il[558]) + , poseidon2_clk(il[559]) + , poseidon2_input_addr(il[560]) + , poseidon2_mem_addr_read_a(il[561]) + , poseidon2_mem_addr_read_b(il[562]) + , poseidon2_mem_addr_read_c(il[563]) + , poseidon2_mem_addr_read_d(il[564]) + , poseidon2_mem_addr_write_a(il[565]) + , poseidon2_mem_addr_write_b(il[566]) + , poseidon2_mem_addr_write_c(il[567]) + , poseidon2_mem_addr_write_d(il[568]) + , poseidon2_output_addr(il[569]) + , poseidon2_sel_poseidon_perm(il[570]) + , range_check_alu_rng_chk(il[571]) + , range_check_clk(il[572]) + , range_check_cmp_hi_bits_rng_chk(il[573]) + , range_check_cmp_lo_bits_rng_chk(il[574]) + , range_check_dyn_diff(il[575]) + , range_check_dyn_rng_chk_bits(il[576]) + , range_check_dyn_rng_chk_pow_2(il[577]) + , range_check_gas_da_rng_chk(il[578]) + , range_check_gas_l2_rng_chk(il[579]) + , range_check_is_lte_u112(il[580]) + , range_check_is_lte_u128(il[581]) + , range_check_is_lte_u16(il[582]) + , range_check_is_lte_u32(il[583]) + , range_check_is_lte_u48(il[584]) + , range_check_is_lte_u64(il[585]) + , range_check_is_lte_u80(il[586]) + , range_check_is_lte_u96(il[587]) + , range_check_mem_rng_chk(il[588]) + , range_check_rng_chk_bits(il[589]) + , range_check_sel_lookup_0(il[590]) + , range_check_sel_lookup_1(il[591]) + , range_check_sel_lookup_2(il[592]) + , range_check_sel_lookup_3(il[593]) + , range_check_sel_lookup_4(il[594]) + , range_check_sel_lookup_5(il[595]) + , range_check_sel_lookup_6(il[596]) + , range_check_sel_rng_chk(il[597]) + , range_check_u16_r0(il[598]) + , range_check_u16_r1(il[599]) + , range_check_u16_r2(il[600]) + , range_check_u16_r3(il[601]) + , range_check_u16_r4(il[602]) + , range_check_u16_r5(il[603]) + , range_check_u16_r6(il[604]) + , range_check_u16_r7(il[605]) + , range_check_value(il[606]) + , sha256_clk(il[607]) + , sha256_input(il[608]) + , sha256_output(il[609]) + , sha256_sel_sha256_compression(il[610]) + , sha256_state(il[611]) + , slice_addr(il[612]) + , slice_clk(il[613]) + , slice_cnt(il[614]) + , slice_col_offset(il[615]) + , slice_one_min_inv(il[616]) + , slice_sel_cd_cpy(il[617]) + , slice_sel_mem_active(il[618]) + , slice_sel_return(il[619]) + , slice_sel_start(il[620]) + , slice_space_id(il[621]) + , slice_val(il[622]) + , lookup_rng_chk_pow_2_counts(il[623]) + , lookup_rng_chk_diff_counts(il[624]) + , lookup_rng_chk_0_counts(il[625]) + , lookup_rng_chk_1_counts(il[626]) + , lookup_rng_chk_2_counts(il[627]) + , lookup_rng_chk_3_counts(il[628]) + , lookup_rng_chk_4_counts(il[629]) + , lookup_rng_chk_5_counts(il[630]) + , lookup_rng_chk_6_counts(il[631]) + , lookup_rng_chk_7_counts(il[632]) + , lookup_pow_2_0_counts(il[633]) + , lookup_pow_2_1_counts(il[634]) + , lookup_byte_lengths_counts(il[635]) + , lookup_byte_operations_counts(il[636]) + , lookup_opcode_gas_counts(il[637]) + , kernel_output_lookup_counts(il[638]) + , lookup_into_kernel_counts(il[639]) + , lookup_cd_value_counts(il[640]) + , lookup_ret_value_counts(il[641]) + , incl_main_tag_err_counts(il[642]) + , incl_mem_tag_err_counts(il[643]) + , perm_rng_mem_inv(il[644]) + , perm_rng_cmp_lo_inv(il[645]) + , perm_rng_cmp_hi_inv(il[646]) + , perm_rng_alu_inv(il[647]) + , perm_cmp_alu_inv(il[648]) + , perm_rng_gas_l2_inv(il[649]) + , perm_rng_gas_da_inv(il[650]) + , perm_pos_mem_read_a_inv(il[651]) + , perm_pos_mem_read_b_inv(il[652]) + , perm_pos_mem_read_c_inv(il[653]) + , perm_pos_mem_read_d_inv(il[654]) + , perm_pos_mem_write_a_inv(il[655]) + , perm_pos_mem_write_b_inv(il[656]) + , perm_pos_mem_write_c_inv(il[657]) + , perm_pos_mem_write_d_inv(il[658]) + , perm_slice_mem_inv(il[659]) + , perm_main_alu_inv(il[660]) + , perm_main_bin_inv(il[661]) + , perm_main_conv_inv(il[662]) + , perm_main_pos2_perm_inv(il[663]) + , perm_main_pedersen_inv(il[664]) + , perm_main_slice_inv(il[665]) + , perm_main_mem_a_inv(il[666]) + , perm_main_mem_b_inv(il[667]) + , perm_main_mem_c_inv(il[668]) + , perm_main_mem_d_inv(il[669]) + , perm_main_mem_ind_addr_a_inv(il[670]) + , perm_main_mem_ind_addr_b_inv(il[671]) + , perm_main_mem_ind_addr_c_inv(il[672]) + , perm_main_mem_ind_addr_d_inv(il[673]) + , lookup_rng_chk_pow_2_inv(il[674]) + , lookup_rng_chk_diff_inv(il[675]) + , lookup_rng_chk_0_inv(il[676]) + , lookup_rng_chk_1_inv(il[677]) + , lookup_rng_chk_2_inv(il[678]) + , lookup_rng_chk_3_inv(il[679]) + , lookup_rng_chk_4_inv(il[680]) + , lookup_rng_chk_5_inv(il[681]) + , lookup_rng_chk_6_inv(il[682]) + , lookup_rng_chk_7_inv(il[683]) + , lookup_pow_2_0_inv(il[684]) + , lookup_pow_2_1_inv(il[685]) + , lookup_byte_lengths_inv(il[686]) + , lookup_byte_operations_inv(il[687]) + , lookup_opcode_gas_inv(il[688]) + , kernel_output_lookup_inv(il[689]) + , lookup_into_kernel_inv(il[690]) + , lookup_cd_value_inv(il[691]) + , lookup_ret_value_inv(il[692]) + , incl_main_tag_err_inv(il[693]) + , incl_mem_tag_err_inv(il[694]) + , binary_acc_ia_shift(il[695]) + , binary_acc_ib_shift(il[696]) + , binary_acc_ic_shift(il[697]) + , binary_mem_tag_ctr_shift(il[698]) + , binary_op_id_shift(il[699]) + , cmp_a_hi_shift(il[700]) + , cmp_a_lo_shift(il[701]) + , cmp_b_hi_shift(il[702]) + , cmp_b_lo_shift(il[703]) + , cmp_cmp_rng_ctr_shift(il[704]) + , cmp_op_gt_shift(il[705]) + , cmp_p_sub_a_hi_shift(il[706]) + , cmp_p_sub_a_lo_shift(il[707]) + , cmp_p_sub_b_hi_shift(il[708]) + , cmp_p_sub_b_lo_shift(il[709]) + , cmp_sel_rng_chk_shift(il[710]) + , main_da_gas_remaining_shift(il[711]) + , main_emit_l2_to_l1_msg_write_offset_shift(il[712]) + , main_emit_note_hash_write_offset_shift(il[713]) + , main_emit_nullifier_write_offset_shift(il[714]) + , main_emit_unencrypted_log_write_offset_shift(il[715]) + , main_internal_return_ptr_shift(il[716]) + , main_l1_to_l2_msg_exists_write_offset_shift(il[717]) + , main_l2_gas_remaining_shift(il[718]) + , main_note_hash_exist_write_offset_shift(il[719]) + , main_nullifier_exists_write_offset_shift(il[720]) + , main_nullifier_non_exists_write_offset_shift(il[721]) + , main_pc_shift(il[722]) + , main_sel_execution_row_shift(il[723]) + , main_side_effect_counter_shift(il[724]) + , main_sload_write_offset_shift(il[725]) + , main_sstore_write_offset_shift(il[726]) + , mem_glob_addr_shift(il[727]) + , mem_rw_shift(il[728]) + , mem_sel_mem_shift(il[729]) + , mem_tag_shift(il[730]) + , mem_tsp_shift(il[731]) + , mem_val_shift(il[732]) + , slice_addr_shift(il[733]) + , slice_clk_shift(il[734]) + , slice_cnt_shift(il[735]) + , slice_col_offset_shift(il[736]) + , slice_sel_cd_cpy_shift(il[737]) + , slice_sel_mem_active_shift(il[738]) + , slice_sel_return_shift(il[739]) + , slice_sel_start_shift(il[740]) + , slice_space_id_shift(il[741]) {} AvmFlavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) @@ -992,7 +991,6 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id main_sel_op_shr[row_idx], main_sel_op_sload[row_idx], main_sel_op_sstore[row_idx], - main_sel_op_storage_address[row_idx], main_sel_op_sub[row_idx], main_sel_op_timestamp[row_idx], main_sel_op_transaction_fee[row_idx], @@ -1739,7 +1737,6 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::main_sel_op_shr = "MAIN_SEL_OP_SHR"; Base::main_sel_op_sload = "MAIN_SEL_OP_SLOAD"; Base::main_sel_op_sstore = "MAIN_SEL_OP_SSTORE"; - Base::main_sel_op_storage_address = "MAIN_SEL_OP_STORAGE_ADDRESS"; Base::main_sel_op_sub = "MAIN_SEL_OP_SUB"; Base::main_sel_op_timestamp = "MAIN_SEL_OP_TIMESTAMP"; Base::main_sel_op_transaction_fee = "MAIN_SEL_OP_TRANSACTION_FEE"; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp index 963e592b3df..6764bd9b758 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp @@ -89,7 +89,7 @@ template using tuple_cat_t = decltype(std::tuple_cat(std:: // The entities that will be used in the flavor. // clang-format off #define PRECOMPUTED_ENTITIES byte_lookup_sel_bin, byte_lookup_table_byte_lengths, byte_lookup_table_in_tags, byte_lookup_table_input_a, byte_lookup_table_input_b, byte_lookup_table_op_id, byte_lookup_table_output, gas_base_da_gas_fixed_table, gas_base_l2_gas_fixed_table, gas_dyn_da_gas_fixed_table, gas_dyn_l2_gas_fixed_table, gas_sel_gas_cost, main_clk, main_sel_first, main_zeroes, powers_power_of_2 -#define WIRE_ENTITIES main_kernel_inputs, main_kernel_value_out, main_kernel_side_effect_out, main_kernel_metadata_out, main_calldata, main_returndata, alu_a_hi, alu_a_lo, alu_b_hi, alu_b_lo, alu_b_pow, alu_c_hi, alu_c_lo, alu_cf, alu_clk, alu_cmp_gadget_gt, alu_cmp_gadget_input_a, alu_cmp_gadget_input_b, alu_cmp_gadget_result, alu_cmp_gadget_sel, alu_ff_tag, alu_ia, alu_ib, alu_ic, alu_in_tag, alu_max_bits_sub_b_bits, alu_max_bits_sub_b_pow, alu_op_add, alu_op_cast, alu_op_div, alu_op_eq, alu_op_lt, alu_op_lte, alu_op_mul, alu_op_not, alu_op_shl, alu_op_shr, alu_op_sub, alu_partial_prod_hi, alu_partial_prod_lo, alu_range_check_input_value, alu_range_check_num_bits, alu_range_check_sel, alu_remainder, alu_sel_alu, alu_sel_cmp, alu_sel_shift_which, alu_u128_tag, alu_u16_tag, alu_u32_tag, alu_u64_tag, alu_u8_tag, alu_zero_shift, binary_acc_ia, binary_acc_ib, binary_acc_ic, binary_clk, binary_ia_bytes, binary_ib_bytes, binary_ic_bytes, binary_in_tag, binary_mem_tag_ctr, binary_mem_tag_ctr_inv, binary_op_id, binary_sel_bin, binary_start, cmp_a_hi, cmp_a_lo, cmp_b_hi, cmp_b_lo, cmp_borrow, cmp_clk, cmp_cmp_rng_ctr, cmp_input_a, cmp_input_b, cmp_op_eq, cmp_op_eq_diff_inv, cmp_op_gt, cmp_p_a_borrow, cmp_p_b_borrow, cmp_p_sub_a_hi, cmp_p_sub_a_lo, cmp_p_sub_b_hi, cmp_p_sub_b_lo, cmp_range_chk_clk, cmp_res_hi, cmp_res_lo, cmp_result, cmp_sel_cmp, cmp_sel_rng_chk, cmp_shift_sel, conversion_clk, conversion_input, conversion_num_limbs, conversion_radix, conversion_sel_to_radix_le, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, main_abs_da_rem_gas, main_abs_l2_rem_gas, main_alu_in_tag, main_base_da_gas_op_cost, main_base_l2_gas_op_cost, main_bin_op_id, main_call_ptr, main_da_gas_remaining, main_da_out_of_gas, main_dyn_da_gas_op_cost, main_dyn_gas_multiplier, main_dyn_l2_gas_op_cost, main_emit_l2_to_l1_msg_write_offset, main_emit_note_hash_write_offset, main_emit_nullifier_write_offset, main_emit_unencrypted_log_write_offset, main_ia, main_ib, main_ic, main_id, main_id_zero, main_ind_addr_a, main_ind_addr_b, main_ind_addr_c, main_ind_addr_d, main_internal_return_ptr, main_inv, main_kernel_in_offset, main_kernel_out_offset, main_l1_to_l2_msg_exists_write_offset, main_l2_gas_remaining, main_l2_out_of_gas, main_mem_addr_a, main_mem_addr_b, main_mem_addr_c, main_mem_addr_d, main_note_hash_exist_write_offset, main_nullifier_exists_write_offset, main_nullifier_non_exists_write_offset, main_op_err, main_opcode_val, main_pc, main_r_in_tag, main_rwa, main_rwb, main_rwc, main_rwd, main_sel_alu, main_sel_bin, main_sel_calldata, main_sel_execution_row, main_sel_kernel_inputs, main_sel_kernel_out, main_sel_last, main_sel_mem_op_a, main_sel_mem_op_b, main_sel_mem_op_c, main_sel_mem_op_d, main_sel_mov_ia_to_ic, main_sel_mov_ib_to_ic, main_sel_op_add, main_sel_op_address, main_sel_op_and, main_sel_op_block_number, main_sel_op_calldata_copy, main_sel_op_cast, main_sel_op_chain_id, main_sel_op_cmov, main_sel_op_coinbase, main_sel_op_dagasleft, main_sel_op_div, main_sel_op_ecadd, main_sel_op_emit_l2_to_l1_msg, main_sel_op_emit_note_hash, main_sel_op_emit_nullifier, main_sel_op_emit_unencrypted_log, main_sel_op_eq, main_sel_op_external_call, main_sel_op_external_return, main_sel_op_external_revert, main_sel_op_fdiv, main_sel_op_fee_per_da_gas, main_sel_op_fee_per_l2_gas, main_sel_op_function_selector, main_sel_op_get_contract_instance, main_sel_op_internal_call, main_sel_op_internal_return, main_sel_op_jump, main_sel_op_jumpi, main_sel_op_keccak, main_sel_op_l1_to_l2_msg_exists, main_sel_op_l2gasleft, main_sel_op_lt, main_sel_op_lte, main_sel_op_mov, main_sel_op_msm, main_sel_op_mul, main_sel_op_not, main_sel_op_note_hash_exists, main_sel_op_nullifier_exists, main_sel_op_or, main_sel_op_pedersen, main_sel_op_pedersen_commit, main_sel_op_poseidon2, main_sel_op_radix_le, main_sel_op_sender, main_sel_op_set, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_storage_address, main_sel_op_sub, main_sel_op_timestamp, main_sel_op_transaction_fee, main_sel_op_version, main_sel_op_xor, main_sel_q_kernel_lookup, main_sel_q_kernel_output_lookup, main_sel_resolve_ind_addr_a, main_sel_resolve_ind_addr_b, main_sel_resolve_ind_addr_c, main_sel_resolve_ind_addr_d, main_sel_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_side_effect_counter, main_sload_write_offset, main_space_id, main_sstore_write_offset, main_tag_err, main_w_in_tag, mem_addr, mem_clk, mem_diff, mem_glob_addr, mem_last, mem_lastAccess, mem_one_min_inv, mem_r_in_tag, mem_rw, mem_sel_mem, mem_sel_mov_ia_to_ic, mem_sel_mov_ib_to_ic, mem_sel_op_a, mem_sel_op_b, mem_sel_op_c, mem_sel_op_cmov, mem_sel_op_d, mem_sel_op_poseidon_read_a, mem_sel_op_poseidon_read_b, mem_sel_op_poseidon_read_c, mem_sel_op_poseidon_read_d, mem_sel_op_poseidon_write_a, mem_sel_op_poseidon_write_b, mem_sel_op_poseidon_write_c, mem_sel_op_poseidon_write_d, mem_sel_op_slice, mem_sel_resolve_ind_addr_a, mem_sel_resolve_ind_addr_b, mem_sel_resolve_ind_addr_c, mem_sel_resolve_ind_addr_d, mem_sel_rng_chk, mem_skip_check_tag, mem_space_id, mem_tag, mem_tag_err, mem_tsp, mem_val, mem_w_in_tag, pedersen_clk, pedersen_input, pedersen_output, pedersen_sel_pedersen, poseidon2_B_10_0, poseidon2_B_10_1, poseidon2_B_10_2, poseidon2_B_10_3, poseidon2_B_11_0, poseidon2_B_11_1, poseidon2_B_11_2, poseidon2_B_11_3, poseidon2_B_12_0, poseidon2_B_12_1, poseidon2_B_12_2, poseidon2_B_12_3, poseidon2_B_13_0, poseidon2_B_13_1, poseidon2_B_13_2, poseidon2_B_13_3, poseidon2_B_14_0, poseidon2_B_14_1, poseidon2_B_14_2, poseidon2_B_14_3, poseidon2_B_15_0, poseidon2_B_15_1, poseidon2_B_15_2, poseidon2_B_15_3, poseidon2_B_16_0, poseidon2_B_16_1, poseidon2_B_16_2, poseidon2_B_16_3, poseidon2_B_17_0, poseidon2_B_17_1, poseidon2_B_17_2, poseidon2_B_17_3, poseidon2_B_18_0, poseidon2_B_18_1, poseidon2_B_18_2, poseidon2_B_18_3, poseidon2_B_19_0, poseidon2_B_19_1, poseidon2_B_19_2, poseidon2_B_19_3, poseidon2_B_20_0, poseidon2_B_20_1, poseidon2_B_20_2, poseidon2_B_20_3, poseidon2_B_21_0, poseidon2_B_21_1, poseidon2_B_21_2, poseidon2_B_21_3, poseidon2_B_22_0, poseidon2_B_22_1, poseidon2_B_22_2, poseidon2_B_22_3, poseidon2_B_23_0, poseidon2_B_23_1, poseidon2_B_23_2, poseidon2_B_23_3, poseidon2_B_24_0, poseidon2_B_24_1, poseidon2_B_24_2, poseidon2_B_24_3, poseidon2_B_25_0, poseidon2_B_25_1, poseidon2_B_25_2, poseidon2_B_25_3, poseidon2_B_26_0, poseidon2_B_26_1, poseidon2_B_26_2, poseidon2_B_26_3, poseidon2_B_27_0, poseidon2_B_27_1, poseidon2_B_27_2, poseidon2_B_27_3, poseidon2_B_28_0, poseidon2_B_28_1, poseidon2_B_28_2, poseidon2_B_28_3, poseidon2_B_29_0, poseidon2_B_29_1, poseidon2_B_29_2, poseidon2_B_29_3, poseidon2_B_30_0, poseidon2_B_30_1, poseidon2_B_30_2, poseidon2_B_30_3, poseidon2_B_31_0, poseidon2_B_31_1, poseidon2_B_31_2, poseidon2_B_31_3, poseidon2_B_32_0, poseidon2_B_32_1, poseidon2_B_32_2, poseidon2_B_32_3, poseidon2_B_33_0, poseidon2_B_33_1, poseidon2_B_33_2, poseidon2_B_33_3, poseidon2_B_34_0, poseidon2_B_34_1, poseidon2_B_34_2, poseidon2_B_34_3, poseidon2_B_35_0, poseidon2_B_35_1, poseidon2_B_35_2, poseidon2_B_35_3, poseidon2_B_36_0, poseidon2_B_36_1, poseidon2_B_36_2, poseidon2_B_36_3, poseidon2_B_37_0, poseidon2_B_37_1, poseidon2_B_37_2, poseidon2_B_37_3, poseidon2_B_38_0, poseidon2_B_38_1, poseidon2_B_38_2, poseidon2_B_38_3, poseidon2_B_39_0, poseidon2_B_39_1, poseidon2_B_39_2, poseidon2_B_39_3, poseidon2_B_40_0, poseidon2_B_40_1, poseidon2_B_40_2, poseidon2_B_40_3, poseidon2_B_41_0, poseidon2_B_41_1, poseidon2_B_41_2, poseidon2_B_41_3, poseidon2_B_42_0, poseidon2_B_42_1, poseidon2_B_42_2, poseidon2_B_42_3, poseidon2_B_43_0, poseidon2_B_43_1, poseidon2_B_43_2, poseidon2_B_43_3, poseidon2_B_44_0, poseidon2_B_44_1, poseidon2_B_44_2, poseidon2_B_44_3, poseidon2_B_45_0, poseidon2_B_45_1, poseidon2_B_45_2, poseidon2_B_45_3, poseidon2_B_46_0, poseidon2_B_46_1, poseidon2_B_46_2, poseidon2_B_46_3, poseidon2_B_47_0, poseidon2_B_47_1, poseidon2_B_47_2, poseidon2_B_47_3, poseidon2_B_48_0, poseidon2_B_48_1, poseidon2_B_48_2, poseidon2_B_48_3, poseidon2_B_49_0, poseidon2_B_49_1, poseidon2_B_49_2, poseidon2_B_49_3, poseidon2_B_4_0, poseidon2_B_4_1, poseidon2_B_4_2, poseidon2_B_4_3, poseidon2_B_50_0, poseidon2_B_50_1, poseidon2_B_50_2, poseidon2_B_50_3, poseidon2_B_51_0, poseidon2_B_51_1, poseidon2_B_51_2, poseidon2_B_51_3, poseidon2_B_52_0, poseidon2_B_52_1, poseidon2_B_52_2, poseidon2_B_52_3, poseidon2_B_53_0, poseidon2_B_53_1, poseidon2_B_53_2, poseidon2_B_53_3, poseidon2_B_54_0, poseidon2_B_54_1, poseidon2_B_54_2, poseidon2_B_54_3, poseidon2_B_55_0, poseidon2_B_55_1, poseidon2_B_55_2, poseidon2_B_55_3, poseidon2_B_56_0, poseidon2_B_56_1, poseidon2_B_56_2, poseidon2_B_56_3, poseidon2_B_57_0, poseidon2_B_57_1, poseidon2_B_57_2, poseidon2_B_57_3, poseidon2_B_58_0, poseidon2_B_58_1, poseidon2_B_58_2, poseidon2_B_58_3, poseidon2_B_59_0, poseidon2_B_59_1, poseidon2_B_59_2, poseidon2_B_59_3, poseidon2_B_5_0, poseidon2_B_5_1, poseidon2_B_5_2, poseidon2_B_5_3, poseidon2_B_6_0, poseidon2_B_6_1, poseidon2_B_6_2, poseidon2_B_6_3, poseidon2_B_7_0, poseidon2_B_7_1, poseidon2_B_7_2, poseidon2_B_7_3, poseidon2_B_8_0, poseidon2_B_8_1, poseidon2_B_8_2, poseidon2_B_8_3, poseidon2_B_9_0, poseidon2_B_9_1, poseidon2_B_9_2, poseidon2_B_9_3, poseidon2_EXT_LAYER_4, poseidon2_EXT_LAYER_5, poseidon2_EXT_LAYER_6, poseidon2_EXT_LAYER_7, poseidon2_T_0_4, poseidon2_T_0_5, poseidon2_T_0_6, poseidon2_T_0_7, poseidon2_T_1_4, poseidon2_T_1_5, poseidon2_T_1_6, poseidon2_T_1_7, poseidon2_T_2_4, poseidon2_T_2_5, poseidon2_T_2_6, poseidon2_T_2_7, poseidon2_T_3_4, poseidon2_T_3_5, poseidon2_T_3_6, poseidon2_T_3_7, poseidon2_T_60_4, poseidon2_T_60_5, poseidon2_T_60_6, poseidon2_T_60_7, poseidon2_T_61_4, poseidon2_T_61_5, poseidon2_T_61_6, poseidon2_T_61_7, poseidon2_T_62_4, poseidon2_T_62_5, poseidon2_T_62_6, poseidon2_T_62_7, poseidon2_T_63_4, poseidon2_T_63_5, poseidon2_T_63_6, poseidon2_T_63_7, poseidon2_a_0, poseidon2_a_1, poseidon2_a_2, poseidon2_a_3, poseidon2_b_0, poseidon2_b_1, poseidon2_b_2, poseidon2_b_3, poseidon2_clk, poseidon2_input_addr, poseidon2_mem_addr_read_a, poseidon2_mem_addr_read_b, poseidon2_mem_addr_read_c, poseidon2_mem_addr_read_d, poseidon2_mem_addr_write_a, poseidon2_mem_addr_write_b, poseidon2_mem_addr_write_c, poseidon2_mem_addr_write_d, poseidon2_output_addr, poseidon2_sel_poseidon_perm, range_check_alu_rng_chk, range_check_clk, range_check_cmp_hi_bits_rng_chk, range_check_cmp_lo_bits_rng_chk, range_check_dyn_diff, range_check_dyn_rng_chk_bits, range_check_dyn_rng_chk_pow_2, range_check_gas_da_rng_chk, range_check_gas_l2_rng_chk, range_check_is_lte_u112, range_check_is_lte_u128, range_check_is_lte_u16, range_check_is_lte_u32, range_check_is_lte_u48, range_check_is_lte_u64, range_check_is_lte_u80, range_check_is_lte_u96, range_check_mem_rng_chk, range_check_rng_chk_bits, range_check_sel_lookup_0, range_check_sel_lookup_1, range_check_sel_lookup_2, range_check_sel_lookup_3, range_check_sel_lookup_4, range_check_sel_lookup_5, range_check_sel_lookup_6, range_check_sel_rng_chk, range_check_u16_r0, range_check_u16_r1, range_check_u16_r2, range_check_u16_r3, range_check_u16_r4, range_check_u16_r5, range_check_u16_r6, range_check_u16_r7, range_check_value, sha256_clk, sha256_input, sha256_output, sha256_sel_sha256_compression, sha256_state, slice_addr, slice_clk, slice_cnt, slice_col_offset, slice_one_min_inv, slice_sel_cd_cpy, slice_sel_mem_active, slice_sel_return, slice_sel_start, slice_space_id, slice_val, lookup_rng_chk_pow_2_counts, lookup_rng_chk_diff_counts, lookup_rng_chk_0_counts, lookup_rng_chk_1_counts, lookup_rng_chk_2_counts, lookup_rng_chk_3_counts, lookup_rng_chk_4_counts, lookup_rng_chk_5_counts, lookup_rng_chk_6_counts, lookup_rng_chk_7_counts, lookup_pow_2_0_counts, lookup_pow_2_1_counts, lookup_byte_lengths_counts, lookup_byte_operations_counts, lookup_opcode_gas_counts, kernel_output_lookup_counts, lookup_into_kernel_counts, lookup_cd_value_counts, lookup_ret_value_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts +#define WIRE_ENTITIES main_kernel_inputs, main_kernel_value_out, main_kernel_side_effect_out, main_kernel_metadata_out, main_calldata, main_returndata, alu_a_hi, alu_a_lo, alu_b_hi, alu_b_lo, alu_b_pow, alu_c_hi, alu_c_lo, alu_cf, alu_clk, alu_cmp_gadget_gt, alu_cmp_gadget_input_a, alu_cmp_gadget_input_b, alu_cmp_gadget_result, alu_cmp_gadget_sel, alu_ff_tag, alu_ia, alu_ib, alu_ic, alu_in_tag, alu_max_bits_sub_b_bits, alu_max_bits_sub_b_pow, alu_op_add, alu_op_cast, alu_op_div, alu_op_eq, alu_op_lt, alu_op_lte, alu_op_mul, alu_op_not, alu_op_shl, alu_op_shr, alu_op_sub, alu_partial_prod_hi, alu_partial_prod_lo, alu_range_check_input_value, alu_range_check_num_bits, alu_range_check_sel, alu_remainder, alu_sel_alu, alu_sel_cmp, alu_sel_shift_which, alu_u128_tag, alu_u16_tag, alu_u32_tag, alu_u64_tag, alu_u8_tag, alu_zero_shift, binary_acc_ia, binary_acc_ib, binary_acc_ic, binary_clk, binary_ia_bytes, binary_ib_bytes, binary_ic_bytes, binary_in_tag, binary_mem_tag_ctr, binary_mem_tag_ctr_inv, binary_op_id, binary_sel_bin, binary_start, cmp_a_hi, cmp_a_lo, cmp_b_hi, cmp_b_lo, cmp_borrow, cmp_clk, cmp_cmp_rng_ctr, cmp_input_a, cmp_input_b, cmp_op_eq, cmp_op_eq_diff_inv, cmp_op_gt, cmp_p_a_borrow, cmp_p_b_borrow, cmp_p_sub_a_hi, cmp_p_sub_a_lo, cmp_p_sub_b_hi, cmp_p_sub_b_lo, cmp_range_chk_clk, cmp_res_hi, cmp_res_lo, cmp_result, cmp_sel_cmp, cmp_sel_rng_chk, cmp_shift_sel, conversion_clk, conversion_input, conversion_num_limbs, conversion_radix, conversion_sel_to_radix_le, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, main_abs_da_rem_gas, main_abs_l2_rem_gas, main_alu_in_tag, main_base_da_gas_op_cost, main_base_l2_gas_op_cost, main_bin_op_id, main_call_ptr, main_da_gas_remaining, main_da_out_of_gas, main_dyn_da_gas_op_cost, main_dyn_gas_multiplier, main_dyn_l2_gas_op_cost, main_emit_l2_to_l1_msg_write_offset, main_emit_note_hash_write_offset, main_emit_nullifier_write_offset, main_emit_unencrypted_log_write_offset, main_ia, main_ib, main_ic, main_id, main_id_zero, main_ind_addr_a, main_ind_addr_b, main_ind_addr_c, main_ind_addr_d, main_internal_return_ptr, main_inv, main_kernel_in_offset, main_kernel_out_offset, main_l1_to_l2_msg_exists_write_offset, main_l2_gas_remaining, main_l2_out_of_gas, main_mem_addr_a, main_mem_addr_b, main_mem_addr_c, main_mem_addr_d, main_note_hash_exist_write_offset, main_nullifier_exists_write_offset, main_nullifier_non_exists_write_offset, main_op_err, main_opcode_val, main_pc, main_r_in_tag, main_rwa, main_rwb, main_rwc, main_rwd, main_sel_alu, main_sel_bin, main_sel_calldata, main_sel_execution_row, main_sel_kernel_inputs, main_sel_kernel_out, main_sel_last, main_sel_mem_op_a, main_sel_mem_op_b, main_sel_mem_op_c, main_sel_mem_op_d, main_sel_mov_ia_to_ic, main_sel_mov_ib_to_ic, main_sel_op_add, main_sel_op_address, main_sel_op_and, main_sel_op_block_number, main_sel_op_calldata_copy, main_sel_op_cast, main_sel_op_chain_id, main_sel_op_cmov, main_sel_op_coinbase, main_sel_op_dagasleft, main_sel_op_div, main_sel_op_ecadd, main_sel_op_emit_l2_to_l1_msg, main_sel_op_emit_note_hash, main_sel_op_emit_nullifier, main_sel_op_emit_unencrypted_log, main_sel_op_eq, main_sel_op_external_call, main_sel_op_external_return, main_sel_op_external_revert, main_sel_op_fdiv, main_sel_op_fee_per_da_gas, main_sel_op_fee_per_l2_gas, main_sel_op_function_selector, main_sel_op_get_contract_instance, main_sel_op_internal_call, main_sel_op_internal_return, main_sel_op_jump, main_sel_op_jumpi, main_sel_op_keccak, main_sel_op_l1_to_l2_msg_exists, main_sel_op_l2gasleft, main_sel_op_lt, main_sel_op_lte, main_sel_op_mov, main_sel_op_msm, main_sel_op_mul, main_sel_op_not, main_sel_op_note_hash_exists, main_sel_op_nullifier_exists, main_sel_op_or, main_sel_op_pedersen, main_sel_op_pedersen_commit, main_sel_op_poseidon2, main_sel_op_radix_le, main_sel_op_sender, main_sel_op_set, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_sub, main_sel_op_timestamp, main_sel_op_transaction_fee, main_sel_op_version, main_sel_op_xor, main_sel_q_kernel_lookup, main_sel_q_kernel_output_lookup, main_sel_resolve_ind_addr_a, main_sel_resolve_ind_addr_b, main_sel_resolve_ind_addr_c, main_sel_resolve_ind_addr_d, main_sel_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_side_effect_counter, main_sload_write_offset, main_space_id, main_sstore_write_offset, main_tag_err, main_w_in_tag, mem_addr, mem_clk, mem_diff, mem_glob_addr, mem_last, mem_lastAccess, mem_one_min_inv, mem_r_in_tag, mem_rw, mem_sel_mem, mem_sel_mov_ia_to_ic, mem_sel_mov_ib_to_ic, mem_sel_op_a, mem_sel_op_b, mem_sel_op_c, mem_sel_op_cmov, mem_sel_op_d, mem_sel_op_poseidon_read_a, mem_sel_op_poseidon_read_b, mem_sel_op_poseidon_read_c, mem_sel_op_poseidon_read_d, mem_sel_op_poseidon_write_a, mem_sel_op_poseidon_write_b, mem_sel_op_poseidon_write_c, mem_sel_op_poseidon_write_d, mem_sel_op_slice, mem_sel_resolve_ind_addr_a, mem_sel_resolve_ind_addr_b, mem_sel_resolve_ind_addr_c, mem_sel_resolve_ind_addr_d, mem_sel_rng_chk, mem_skip_check_tag, mem_space_id, mem_tag, mem_tag_err, mem_tsp, mem_val, mem_w_in_tag, pedersen_clk, pedersen_input, pedersen_output, pedersen_sel_pedersen, poseidon2_B_10_0, poseidon2_B_10_1, poseidon2_B_10_2, poseidon2_B_10_3, poseidon2_B_11_0, poseidon2_B_11_1, poseidon2_B_11_2, poseidon2_B_11_3, poseidon2_B_12_0, poseidon2_B_12_1, poseidon2_B_12_2, poseidon2_B_12_3, poseidon2_B_13_0, poseidon2_B_13_1, poseidon2_B_13_2, poseidon2_B_13_3, poseidon2_B_14_0, poseidon2_B_14_1, poseidon2_B_14_2, poseidon2_B_14_3, poseidon2_B_15_0, poseidon2_B_15_1, poseidon2_B_15_2, poseidon2_B_15_3, poseidon2_B_16_0, poseidon2_B_16_1, poseidon2_B_16_2, poseidon2_B_16_3, poseidon2_B_17_0, poseidon2_B_17_1, poseidon2_B_17_2, poseidon2_B_17_3, poseidon2_B_18_0, poseidon2_B_18_1, poseidon2_B_18_2, poseidon2_B_18_3, poseidon2_B_19_0, poseidon2_B_19_1, poseidon2_B_19_2, poseidon2_B_19_3, poseidon2_B_20_0, poseidon2_B_20_1, poseidon2_B_20_2, poseidon2_B_20_3, poseidon2_B_21_0, poseidon2_B_21_1, poseidon2_B_21_2, poseidon2_B_21_3, poseidon2_B_22_0, poseidon2_B_22_1, poseidon2_B_22_2, poseidon2_B_22_3, poseidon2_B_23_0, poseidon2_B_23_1, poseidon2_B_23_2, poseidon2_B_23_3, poseidon2_B_24_0, poseidon2_B_24_1, poseidon2_B_24_2, poseidon2_B_24_3, poseidon2_B_25_0, poseidon2_B_25_1, poseidon2_B_25_2, poseidon2_B_25_3, poseidon2_B_26_0, poseidon2_B_26_1, poseidon2_B_26_2, poseidon2_B_26_3, poseidon2_B_27_0, poseidon2_B_27_1, poseidon2_B_27_2, poseidon2_B_27_3, poseidon2_B_28_0, poseidon2_B_28_1, poseidon2_B_28_2, poseidon2_B_28_3, poseidon2_B_29_0, poseidon2_B_29_1, poseidon2_B_29_2, poseidon2_B_29_3, poseidon2_B_30_0, poseidon2_B_30_1, poseidon2_B_30_2, poseidon2_B_30_3, poseidon2_B_31_0, poseidon2_B_31_1, poseidon2_B_31_2, poseidon2_B_31_3, poseidon2_B_32_0, poseidon2_B_32_1, poseidon2_B_32_2, poseidon2_B_32_3, poseidon2_B_33_0, poseidon2_B_33_1, poseidon2_B_33_2, poseidon2_B_33_3, poseidon2_B_34_0, poseidon2_B_34_1, poseidon2_B_34_2, poseidon2_B_34_3, poseidon2_B_35_0, poseidon2_B_35_1, poseidon2_B_35_2, poseidon2_B_35_3, poseidon2_B_36_0, poseidon2_B_36_1, poseidon2_B_36_2, poseidon2_B_36_3, poseidon2_B_37_0, poseidon2_B_37_1, poseidon2_B_37_2, poseidon2_B_37_3, poseidon2_B_38_0, poseidon2_B_38_1, poseidon2_B_38_2, poseidon2_B_38_3, poseidon2_B_39_0, poseidon2_B_39_1, poseidon2_B_39_2, poseidon2_B_39_3, poseidon2_B_40_0, poseidon2_B_40_1, poseidon2_B_40_2, poseidon2_B_40_3, poseidon2_B_41_0, poseidon2_B_41_1, poseidon2_B_41_2, poseidon2_B_41_3, poseidon2_B_42_0, poseidon2_B_42_1, poseidon2_B_42_2, poseidon2_B_42_3, poseidon2_B_43_0, poseidon2_B_43_1, poseidon2_B_43_2, poseidon2_B_43_3, poseidon2_B_44_0, poseidon2_B_44_1, poseidon2_B_44_2, poseidon2_B_44_3, poseidon2_B_45_0, poseidon2_B_45_1, poseidon2_B_45_2, poseidon2_B_45_3, poseidon2_B_46_0, poseidon2_B_46_1, poseidon2_B_46_2, poseidon2_B_46_3, poseidon2_B_47_0, poseidon2_B_47_1, poseidon2_B_47_2, poseidon2_B_47_3, poseidon2_B_48_0, poseidon2_B_48_1, poseidon2_B_48_2, poseidon2_B_48_3, poseidon2_B_49_0, poseidon2_B_49_1, poseidon2_B_49_2, poseidon2_B_49_3, poseidon2_B_4_0, poseidon2_B_4_1, poseidon2_B_4_2, poseidon2_B_4_3, poseidon2_B_50_0, poseidon2_B_50_1, poseidon2_B_50_2, poseidon2_B_50_3, poseidon2_B_51_0, poseidon2_B_51_1, poseidon2_B_51_2, poseidon2_B_51_3, poseidon2_B_52_0, poseidon2_B_52_1, poseidon2_B_52_2, poseidon2_B_52_3, poseidon2_B_53_0, poseidon2_B_53_1, poseidon2_B_53_2, poseidon2_B_53_3, poseidon2_B_54_0, poseidon2_B_54_1, poseidon2_B_54_2, poseidon2_B_54_3, poseidon2_B_55_0, poseidon2_B_55_1, poseidon2_B_55_2, poseidon2_B_55_3, poseidon2_B_56_0, poseidon2_B_56_1, poseidon2_B_56_2, poseidon2_B_56_3, poseidon2_B_57_0, poseidon2_B_57_1, poseidon2_B_57_2, poseidon2_B_57_3, poseidon2_B_58_0, poseidon2_B_58_1, poseidon2_B_58_2, poseidon2_B_58_3, poseidon2_B_59_0, poseidon2_B_59_1, poseidon2_B_59_2, poseidon2_B_59_3, poseidon2_B_5_0, poseidon2_B_5_1, poseidon2_B_5_2, poseidon2_B_5_3, poseidon2_B_6_0, poseidon2_B_6_1, poseidon2_B_6_2, poseidon2_B_6_3, poseidon2_B_7_0, poseidon2_B_7_1, poseidon2_B_7_2, poseidon2_B_7_3, poseidon2_B_8_0, poseidon2_B_8_1, poseidon2_B_8_2, poseidon2_B_8_3, poseidon2_B_9_0, poseidon2_B_9_1, poseidon2_B_9_2, poseidon2_B_9_3, poseidon2_EXT_LAYER_4, poseidon2_EXT_LAYER_5, poseidon2_EXT_LAYER_6, poseidon2_EXT_LAYER_7, poseidon2_T_0_4, poseidon2_T_0_5, poseidon2_T_0_6, poseidon2_T_0_7, poseidon2_T_1_4, poseidon2_T_1_5, poseidon2_T_1_6, poseidon2_T_1_7, poseidon2_T_2_4, poseidon2_T_2_5, poseidon2_T_2_6, poseidon2_T_2_7, poseidon2_T_3_4, poseidon2_T_3_5, poseidon2_T_3_6, poseidon2_T_3_7, poseidon2_T_60_4, poseidon2_T_60_5, poseidon2_T_60_6, poseidon2_T_60_7, poseidon2_T_61_4, poseidon2_T_61_5, poseidon2_T_61_6, poseidon2_T_61_7, poseidon2_T_62_4, poseidon2_T_62_5, poseidon2_T_62_6, poseidon2_T_62_7, poseidon2_T_63_4, poseidon2_T_63_5, poseidon2_T_63_6, poseidon2_T_63_7, poseidon2_a_0, poseidon2_a_1, poseidon2_a_2, poseidon2_a_3, poseidon2_b_0, poseidon2_b_1, poseidon2_b_2, poseidon2_b_3, poseidon2_clk, poseidon2_input_addr, poseidon2_mem_addr_read_a, poseidon2_mem_addr_read_b, poseidon2_mem_addr_read_c, poseidon2_mem_addr_read_d, poseidon2_mem_addr_write_a, poseidon2_mem_addr_write_b, poseidon2_mem_addr_write_c, poseidon2_mem_addr_write_d, poseidon2_output_addr, poseidon2_sel_poseidon_perm, range_check_alu_rng_chk, range_check_clk, range_check_cmp_hi_bits_rng_chk, range_check_cmp_lo_bits_rng_chk, range_check_dyn_diff, range_check_dyn_rng_chk_bits, range_check_dyn_rng_chk_pow_2, range_check_gas_da_rng_chk, range_check_gas_l2_rng_chk, range_check_is_lte_u112, range_check_is_lte_u128, range_check_is_lte_u16, range_check_is_lte_u32, range_check_is_lte_u48, range_check_is_lte_u64, range_check_is_lte_u80, range_check_is_lte_u96, range_check_mem_rng_chk, range_check_rng_chk_bits, range_check_sel_lookup_0, range_check_sel_lookup_1, range_check_sel_lookup_2, range_check_sel_lookup_3, range_check_sel_lookup_4, range_check_sel_lookup_5, range_check_sel_lookup_6, range_check_sel_rng_chk, range_check_u16_r0, range_check_u16_r1, range_check_u16_r2, range_check_u16_r3, range_check_u16_r4, range_check_u16_r5, range_check_u16_r6, range_check_u16_r7, range_check_value, sha256_clk, sha256_input, sha256_output, sha256_sel_sha256_compression, sha256_state, slice_addr, slice_clk, slice_cnt, slice_col_offset, slice_one_min_inv, slice_sel_cd_cpy, slice_sel_mem_active, slice_sel_return, slice_sel_start, slice_space_id, slice_val, lookup_rng_chk_pow_2_counts, lookup_rng_chk_diff_counts, lookup_rng_chk_0_counts, lookup_rng_chk_1_counts, lookup_rng_chk_2_counts, lookup_rng_chk_3_counts, lookup_rng_chk_4_counts, lookup_rng_chk_5_counts, lookup_rng_chk_6_counts, lookup_rng_chk_7_counts, lookup_pow_2_0_counts, lookup_pow_2_1_counts, lookup_byte_lengths_counts, lookup_byte_operations_counts, lookup_opcode_gas_counts, kernel_output_lookup_counts, lookup_into_kernel_counts, lookup_cd_value_counts, lookup_ret_value_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts #define DERIVED_WITNESS_ENTITIES perm_rng_mem_inv, perm_rng_cmp_lo_inv, perm_rng_cmp_hi_inv, perm_rng_alu_inv, perm_cmp_alu_inv, perm_rng_gas_l2_inv, perm_rng_gas_da_inv, perm_pos_mem_read_a_inv, perm_pos_mem_read_b_inv, perm_pos_mem_read_c_inv, perm_pos_mem_read_d_inv, perm_pos_mem_write_a_inv, perm_pos_mem_write_b_inv, perm_pos_mem_write_c_inv, perm_pos_mem_write_d_inv, perm_slice_mem_inv, perm_main_alu_inv, perm_main_bin_inv, perm_main_conv_inv, perm_main_pos2_perm_inv, perm_main_pedersen_inv, perm_main_slice_inv, perm_main_mem_a_inv, perm_main_mem_b_inv, perm_main_mem_c_inv, perm_main_mem_d_inv, perm_main_mem_ind_addr_a_inv, perm_main_mem_ind_addr_b_inv, perm_main_mem_ind_addr_c_inv, perm_main_mem_ind_addr_d_inv, lookup_rng_chk_pow_2_inv, lookup_rng_chk_diff_inv, lookup_rng_chk_0_inv, lookup_rng_chk_1_inv, lookup_rng_chk_2_inv, lookup_rng_chk_3_inv, lookup_rng_chk_4_inv, lookup_rng_chk_5_inv, lookup_rng_chk_6_inv, lookup_rng_chk_7_inv, lookup_pow_2_0_inv, lookup_pow_2_1_inv, lookup_byte_lengths_inv, lookup_byte_operations_inv, lookup_opcode_gas_inv, kernel_output_lookup_inv, lookup_into_kernel_inv, lookup_cd_value_inv, lookup_ret_value_inv, incl_main_tag_err_inv, incl_mem_tag_err_inv #define SHIFTED_ENTITIES binary_acc_ia_shift, binary_acc_ib_shift, binary_acc_ic_shift, binary_mem_tag_ctr_shift, binary_op_id_shift, cmp_a_hi_shift, cmp_a_lo_shift, cmp_b_hi_shift, cmp_b_lo_shift, cmp_cmp_rng_ctr_shift, cmp_op_gt_shift, cmp_p_sub_a_hi_shift, cmp_p_sub_a_lo_shift, cmp_p_sub_b_hi_shift, cmp_p_sub_b_lo_shift, cmp_sel_rng_chk_shift, main_da_gas_remaining_shift, main_emit_l2_to_l1_msg_write_offset_shift, main_emit_note_hash_write_offset_shift, main_emit_nullifier_write_offset_shift, main_emit_unencrypted_log_write_offset_shift, main_internal_return_ptr_shift, main_l1_to_l2_msg_exists_write_offset_shift, main_l2_gas_remaining_shift, main_note_hash_exist_write_offset_shift, main_nullifier_exists_write_offset_shift, main_nullifier_non_exists_write_offset_shift, main_pc_shift, main_sel_execution_row_shift, main_side_effect_counter_shift, main_sload_write_offset_shift, main_sstore_write_offset_shift, mem_glob_addr_shift, mem_rw_shift, mem_sel_mem_shift, mem_tag_shift, mem_tsp_shift, mem_val_shift, slice_addr_shift, slice_clk_shift, slice_cnt_shift, slice_col_offset_shift, slice_sel_cd_cpy_shift, slice_sel_mem_active_shift, slice_sel_return_shift, slice_sel_start_shift, slice_space_id_shift #define TO_BE_SHIFTED(e) e.binary_acc_ia, e.binary_acc_ib, e.binary_acc_ic, e.binary_mem_tag_ctr, e.binary_op_id, e.cmp_a_hi, e.cmp_a_lo, e.cmp_b_hi, e.cmp_b_lo, e.cmp_cmp_rng_ctr, e.cmp_op_gt, e.cmp_p_sub_a_hi, e.cmp_p_sub_a_lo, e.cmp_p_sub_b_hi, e.cmp_p_sub_b_lo, e.cmp_sel_rng_chk, e.main_da_gas_remaining, e.main_emit_l2_to_l1_msg_write_offset, e.main_emit_note_hash_write_offset, e.main_emit_nullifier_write_offset, e.main_emit_unencrypted_log_write_offset, e.main_internal_return_ptr, e.main_l1_to_l2_msg_exists_write_offset, e.main_l2_gas_remaining, e.main_note_hash_exist_write_offset, e.main_nullifier_exists_write_offset, e.main_nullifier_non_exists_write_offset, e.main_pc, e.main_sel_execution_row, e.main_side_effect_counter, e.main_sload_write_offset, e.main_sstore_write_offset, e.mem_glob_addr, e.mem_rw, e.mem_sel_mem, e.mem_tag, e.mem_tsp, e.mem_val, e.slice_addr, e.slice_clk, e.slice_cnt, e.slice_col_offset, e.slice_sel_cd_cpy, e.slice_sel_mem_active, e.slice_sel_return, e.slice_sel_start, e.slice_space_id @@ -118,12 +118,12 @@ class AvmFlavor { static constexpr bool HasZK = false; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 16; - static constexpr size_t NUM_WITNESS_ENTITIES = 680; + static constexpr size_t NUM_WITNESS_ENTITIES = 679; static constexpr size_t NUM_SHIFTED_ENTITIES = 47; static constexpr size_t NUM_WIRES = NUM_WITNESS_ENTITIES + NUM_PRECOMPUTED_ENTITIES; // We have two copies of the witness entities, so we subtract the number of fixed ones (they have no shift), one for // the unshifted and one for the shifted - static constexpr size_t NUM_ALL_ENTITIES = 743; + static constexpr size_t NUM_ALL_ENTITIES = 742; // The total number of witnesses including shifts and derived entities. static constexpr size_t NUM_ALL_WITNESS_ENTITIES = NUM_WITNESS_ENTITIES + NUM_SHIFTED_ENTITIES; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp index 01ac46e02d8..032d999083b 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp @@ -247,7 +247,6 @@ template std::vector AvmFullRow::names() "main_sel_op_shr", "main_sel_op_sload", "main_sel_op_sstore", - "main_sel_op_storage_address", "main_sel_op_sub", "main_sel_op_timestamp", "main_sel_op_transaction_fee", @@ -948,7 +947,6 @@ template RefVector AvmFullRow::as_vector() const main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, - main_sel_op_storage_address, main_sel_op_sub, main_sel_op_timestamp, main_sel_op_transaction_fee, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp index bf958cce1b4..96c6767c3e0 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp @@ -238,7 +238,6 @@ template struct AvmFullRow { FF main_sel_op_shr{}; FF main_sel_op_sload{}; FF main_sel_op_sstore{}; - FF main_sel_op_storage_address{}; FF main_sel_op_sub{}; FF main_sel_op_timestamp{}; FF main_sel_op_transaction_fee{}; @@ -710,7 +709,7 @@ template struct AvmFullRow { RefVector as_vector() const; static std::vector names(); - static constexpr size_t SIZE = 696; + static constexpr size_t SIZE = 695; }; template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel.hpp index 6fa15bbad85..579287c7880 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel.hpp @@ -10,9 +10,9 @@ template class kernelImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; template void static accumulate(ContainerOverSubrelations& evals, @@ -22,7 +22,6 @@ template class kernelImpl { { const auto constants_SENDER_SELECTOR = FF(0); const auto constants_ADDRESS_SELECTOR = FF(1); - const auto constants_STORAGE_ADDRESS_SELECTOR = FF(1); const auto constants_FUNCTION_SELECTOR_SELECTOR = FF(2); const auto constants_CHAIN_ID_SELECTOR = FF(29); const auto constants_VERSION_SELECTOR = FF(30); @@ -42,18 +41,16 @@ template class kernelImpl { const auto constants_START_EMIT_NULLIFIER_WRITE_OFFSET = FF(144); const auto constants_START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET = FF(160); const auto constants_START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET = FF(162); - const auto main_KERNEL_INPUT_SELECTORS = - (((((((((((new_term.main_sel_op_address + new_term.main_sel_op_storage_address) + - new_term.main_sel_op_sender) + - new_term.main_sel_op_function_selector) + - new_term.main_sel_op_transaction_fee) + - new_term.main_sel_op_chain_id) + - new_term.main_sel_op_version) + - new_term.main_sel_op_block_number) + - new_term.main_sel_op_coinbase) + - new_term.main_sel_op_timestamp) + - new_term.main_sel_op_fee_per_l2_gas) + - new_term.main_sel_op_fee_per_da_gas); + const auto main_KERNEL_INPUT_SELECTORS = ((((((((((new_term.main_sel_op_address + new_term.main_sel_op_sender) + + new_term.main_sel_op_function_selector) + + new_term.main_sel_op_transaction_fee) + + new_term.main_sel_op_chain_id) + + new_term.main_sel_op_version) + + new_term.main_sel_op_block_number) + + new_term.main_sel_op_coinbase) + + new_term.main_sel_op_timestamp) + + new_term.main_sel_op_fee_per_l2_gas) + + new_term.main_sel_op_fee_per_da_gas); const auto main_KERNEL_OUTPUT_SELECTORS = ((((((((new_term.main_sel_op_note_hash_exists + new_term.main_sel_op_emit_note_hash) + new_term.main_sel_op_nullifier_exists) + @@ -155,107 +152,100 @@ template class kernelImpl { } { using Accumulator = typename std::tuple_element_t<11, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_storage_address * - (new_term.main_kernel_in_offset - constants_STORAGE_ADDRESS_SELECTOR)); + auto tmp = (new_term.main_sel_op_sender * (new_term.main_kernel_in_offset - constants_SENDER_SELECTOR)); tmp *= scaling_factor; std::get<11>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<12, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sender * (new_term.main_kernel_in_offset - constants_SENDER_SELECTOR)); + auto tmp = (new_term.main_sel_op_function_selector * + (new_term.main_kernel_in_offset - constants_FUNCTION_SELECTOR_SELECTOR)); tmp *= scaling_factor; std::get<12>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<13, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_function_selector * - (new_term.main_kernel_in_offset - constants_FUNCTION_SELECTOR_SELECTOR)); + auto tmp = (new_term.main_sel_op_transaction_fee * + (new_term.main_kernel_in_offset - constants_TRANSACTION_FEE_SELECTOR)); tmp *= scaling_factor; std::get<13>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<14, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_transaction_fee * - (new_term.main_kernel_in_offset - constants_TRANSACTION_FEE_SELECTOR)); + auto tmp = (new_term.main_sel_op_chain_id * (new_term.main_kernel_in_offset - constants_CHAIN_ID_SELECTOR)); tmp *= scaling_factor; std::get<14>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<15, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_chain_id * (new_term.main_kernel_in_offset - constants_CHAIN_ID_SELECTOR)); + auto tmp = (new_term.main_sel_op_version * (new_term.main_kernel_in_offset - constants_VERSION_SELECTOR)); tmp *= scaling_factor; std::get<15>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<16, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_version * (new_term.main_kernel_in_offset - constants_VERSION_SELECTOR)); + auto tmp = (new_term.main_sel_op_block_number * + (new_term.main_kernel_in_offset - constants_BLOCK_NUMBER_SELECTOR)); tmp *= scaling_factor; std::get<16>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<17, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_block_number * - (new_term.main_kernel_in_offset - constants_BLOCK_NUMBER_SELECTOR)); + auto tmp = + (new_term.main_sel_op_timestamp * (new_term.main_kernel_in_offset - constants_TIMESTAMP_SELECTOR)); tmp *= scaling_factor; std::get<17>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<18, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_timestamp * (new_term.main_kernel_in_offset - constants_TIMESTAMP_SELECTOR)); + auto tmp = (new_term.main_sel_op_coinbase * (new_term.main_kernel_in_offset - constants_COINBASE_SELECTOR)); tmp *= scaling_factor; std::get<18>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<19, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_coinbase * (new_term.main_kernel_in_offset - constants_COINBASE_SELECTOR)); - tmp *= scaling_factor; - std::get<19>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<20, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_fee_per_da_gas * (new_term.main_kernel_in_offset - constants_FEE_PER_DA_GAS_SELECTOR)); tmp *= scaling_factor; - std::get<20>(evals) += typename Accumulator::View(tmp); + std::get<19>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<21, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<20, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_fee_per_l2_gas * (new_term.main_kernel_in_offset - constants_FEE_PER_L2_GAS_SELECTOR)); tmp *= scaling_factor; - std::get<21>(evals) += typename Accumulator::View(tmp); + std::get<20>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<22, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<21, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_note_hash_exists * (new_term.main_kernel_out_offset - (constants_START_NOTE_HASH_EXISTS_WRITE_OFFSET + new_term.main_note_hash_exist_write_offset))); tmp *= scaling_factor; - std::get<22>(evals) += typename Accumulator::View(tmp); + std::get<21>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<23, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<22, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_note_hash_exist_write_offset); tmp *= scaling_factor; - std::get<23>(evals) += typename Accumulator::View(tmp); + std::get<22>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<24, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<23, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_emit_note_hash * (new_term.main_kernel_out_offset - (constants_START_EMIT_NOTE_HASH_WRITE_OFFSET + new_term.main_emit_note_hash_write_offset))); tmp *= scaling_factor; - std::get<24>(evals) += typename Accumulator::View(tmp); + std::get<23>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<25, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<24, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_emit_note_hash_write_offset); tmp *= scaling_factor; - std::get<25>(evals) += typename Accumulator::View(tmp); + std::get<24>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<26, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<25, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_nullifier_exists * (new_term.main_kernel_out_offset - ((new_term.main_ib * @@ -263,122 +253,122 @@ template class kernelImpl { ((FF(1) - new_term.main_ib) * (constants_START_NULLIFIER_NON_EXISTS_OFFSET + new_term.main_nullifier_non_exists_write_offset))))); tmp *= scaling_factor; - std::get<26>(evals) += typename Accumulator::View(tmp); + std::get<25>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<27, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<26, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_nullifier_exists_write_offset); tmp *= scaling_factor; - std::get<27>(evals) += typename Accumulator::View(tmp); + std::get<26>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<28, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<27, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_nullifier_non_exists_write_offset); tmp *= scaling_factor; - std::get<28>(evals) += typename Accumulator::View(tmp); + std::get<27>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<29, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<28, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_emit_nullifier * (new_term.main_kernel_out_offset - (constants_START_EMIT_NULLIFIER_WRITE_OFFSET + new_term.main_emit_nullifier_write_offset))); tmp *= scaling_factor; - std::get<29>(evals) += typename Accumulator::View(tmp); + std::get<28>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<30, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<29, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_emit_nullifier_write_offset); tmp *= scaling_factor; - std::get<30>(evals) += typename Accumulator::View(tmp); + std::get<29>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<31, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<30, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_l1_to_l2_msg_exists * (new_term.main_kernel_out_offset - (constants_START_L1_TO_L2_MSG_EXISTS_WRITE_OFFSET + new_term.main_l1_to_l2_msg_exists_write_offset))); tmp *= scaling_factor; - std::get<31>(evals) += typename Accumulator::View(tmp); + std::get<30>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<32, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<31, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_l1_to_l2_msg_exists_write_offset); tmp *= scaling_factor; - std::get<32>(evals) += typename Accumulator::View(tmp); + std::get<31>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<33, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<32, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_emit_unencrypted_log * (new_term.main_kernel_out_offset - (constants_START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET + new_term.main_emit_unencrypted_log_write_offset))); tmp *= scaling_factor; - std::get<33>(evals) += typename Accumulator::View(tmp); + std::get<32>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<34, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<33, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_emit_unencrypted_log_write_offset); tmp *= scaling_factor; - std::get<34>(evals) += typename Accumulator::View(tmp); + std::get<33>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<35, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<34, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_emit_l2_to_l1_msg * (new_term.main_kernel_out_offset - (constants_START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET + new_term.main_emit_l2_to_l1_msg_write_offset))); tmp *= scaling_factor; - std::get<35>(evals) += typename Accumulator::View(tmp); + std::get<34>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<36, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<35, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_emit_l2_to_l1_msg_write_offset); tmp *= scaling_factor; - std::get<36>(evals) += typename Accumulator::View(tmp); + std::get<35>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<37, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<36, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_sload * (new_term.main_kernel_out_offset - (constants_START_SLOAD_WRITE_OFFSET + new_term.main_sload_write_offset))); tmp *= scaling_factor; - std::get<37>(evals) += typename Accumulator::View(tmp); + std::get<36>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<38, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<37, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_sload_write_offset); tmp *= scaling_factor; - std::get<38>(evals) += typename Accumulator::View(tmp); + std::get<37>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<39, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<38, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_sstore * (new_term.main_kernel_out_offset - (constants_START_SSTORE_WRITE_OFFSET + new_term.main_sstore_write_offset))); tmp *= scaling_factor; - std::get<39>(evals) += typename Accumulator::View(tmp); + std::get<38>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<40, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<39, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_sstore_write_offset); tmp *= scaling_factor; - std::get<40>(evals) += typename Accumulator::View(tmp); + std::get<39>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<41, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<40, ContainerOverSubrelations>; auto tmp = (main_KERNEL_OUTPUT_SELECTORS * (new_term.main_side_effect_counter_shift - (new_term.main_side_effect_counter + FF(1)))); tmp *= scaling_factor; - std::get<41>(evals) += typename Accumulator::View(tmp); + std::get<40>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<42, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<41, ContainerOverSubrelations>; auto tmp = (main_KERNEL_INPUT_SELECTORS * (FF(1) - new_term.main_sel_q_kernel_lookup)); tmp *= scaling_factor; - std::get<42>(evals) += typename Accumulator::View(tmp); + std::get<41>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<43, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<42, ContainerOverSubrelations>; auto tmp = (main_KERNEL_OUTPUT_SELECTORS * (FF(1) - new_term.main_sel_q_kernel_output_lookup)); tmp *= scaling_factor; - std::get<43>(evals) += typename Accumulator::View(tmp); + std::get<42>(evals) += typename Accumulator::View(tmp); } } }; @@ -413,50 +403,48 @@ template class kernel : public Relation> { case 10: return "ADDRESS_KERNEL"; case 11: - return "STORAGE_ADDRESS_KERNEL"; - case 12: return "SENDER_KERNEL"; - case 13: + case 12: return "FUNCTION_SELECTOR_KERNEL"; - case 14: + case 13: return "FEE_TRANSACTION_FEE_KERNEL"; - case 15: + case 14: return "CHAIN_ID_KERNEL"; - case 16: + case 15: return "VERSION_KERNEL"; - case 17: + case 16: return "BLOCK_NUMBER_KERNEL"; - case 18: + case 17: return "TIMESTAMP_KERNEL"; - case 19: + case 18: return "COINBASE_KERNEL"; - case 20: + case 19: return "FEE_DA_GAS_KERNEL"; - case 21: + case 20: return "FEE_L2_GAS_KERNEL"; - case 22: + case 21: return "NOTE_HASH_KERNEL_OUTPUT"; - case 24: + case 23: return "EMIT_NOTE_HASH_KERNEL_OUTPUT"; - case 26: + case 25: return "NULLIFIER_EXISTS_KERNEL_OUTPUT"; - case 29: + case 28: return "EMIT_NULLIFIER_KERNEL_OUTPUT"; - case 31: + case 30: return "L1_TO_L2_MSG_EXISTS_KERNEL_OUTPUT"; - case 33: + case 32: return "EMIT_UNENCRYPTED_LOG_KERNEL_OUTPUT"; - case 35: + case 34: return "EMIT_L2_TO_L1_MSGS_KERNEL_OUTPUT"; - case 37: + case 36: return "SLOAD_KERNEL_OUTPUT"; - case 39: + case 38: return "SSTORE_KERNEL_OUTPUT"; - case 41: + case 40: return "SIDE_EFFECT_COUNTER_INCREMENT"; - case 42: + case 41: return "KERNEL_INPUT_ACTIVE_CHECK"; - case 43: + case 42: return "KERNEL_OUTPUT_ACTIVE_CHECK"; } return std::to_string(index); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp index 0c62e3d4004..6d1f18c6be7 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp @@ -10,11 +10,11 @@ template class mainImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, 3, 3, 3, 4, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 4, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, 2, 2 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, 3, 3, 3, 4, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 4, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, 2, 2 }; template @@ -24,18 +24,16 @@ template class mainImpl { [[maybe_unused]] const FF& scaling_factor) { const auto constants_misc_INTERNAL_CALL_SPACE_ID = FF(255); - const auto main_KERNEL_INPUT_SELECTORS = - (((((((((((new_term.main_sel_op_address + new_term.main_sel_op_storage_address) + - new_term.main_sel_op_sender) + - new_term.main_sel_op_function_selector) + - new_term.main_sel_op_transaction_fee) + - new_term.main_sel_op_chain_id) + - new_term.main_sel_op_version) + - new_term.main_sel_op_block_number) + - new_term.main_sel_op_coinbase) + - new_term.main_sel_op_timestamp) + - new_term.main_sel_op_fee_per_l2_gas) + - new_term.main_sel_op_fee_per_da_gas); + const auto main_KERNEL_INPUT_SELECTORS = ((((((((((new_term.main_sel_op_address + new_term.main_sel_op_sender) + + new_term.main_sel_op_function_selector) + + new_term.main_sel_op_transaction_fee) + + new_term.main_sel_op_chain_id) + + new_term.main_sel_op_version) + + new_term.main_sel_op_block_number) + + new_term.main_sel_op_coinbase) + + new_term.main_sel_op_timestamp) + + new_term.main_sel_op_fee_per_l2_gas) + + new_term.main_sel_op_fee_per_da_gas); const auto main_KERNEL_OUTPUT_SELECTORS = ((((((((new_term.main_sel_op_note_hash_exists + new_term.main_sel_op_emit_note_hash) + new_term.main_sel_op_nullifier_exists) + @@ -106,693 +104,687 @@ template class mainImpl { } { using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_storage_address * (FF(1) - new_term.main_sel_op_storage_address)); + auto tmp = (new_term.main_sel_op_sender * (FF(1) - new_term.main_sel_op_sender)); tmp *= scaling_factor; std::get<3>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sender * (FF(1) - new_term.main_sel_op_sender)); + auto tmp = (new_term.main_sel_op_function_selector * (FF(1) - new_term.main_sel_op_function_selector)); tmp *= scaling_factor; std::get<4>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_function_selector * (FF(1) - new_term.main_sel_op_function_selector)); + auto tmp = (new_term.main_sel_op_transaction_fee * (FF(1) - new_term.main_sel_op_transaction_fee)); tmp *= scaling_factor; std::get<5>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_transaction_fee * (FF(1) - new_term.main_sel_op_transaction_fee)); + auto tmp = (new_term.main_sel_op_chain_id * (FF(1) - new_term.main_sel_op_chain_id)); tmp *= scaling_factor; std::get<6>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_chain_id * (FF(1) - new_term.main_sel_op_chain_id)); + auto tmp = (new_term.main_sel_op_version * (FF(1) - new_term.main_sel_op_version)); tmp *= scaling_factor; std::get<7>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_version * (FF(1) - new_term.main_sel_op_version)); + auto tmp = (new_term.main_sel_op_block_number * (FF(1) - new_term.main_sel_op_block_number)); tmp *= scaling_factor; std::get<8>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_block_number * (FF(1) - new_term.main_sel_op_block_number)); + auto tmp = (new_term.main_sel_op_coinbase * (FF(1) - new_term.main_sel_op_coinbase)); tmp *= scaling_factor; std::get<9>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<10, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_coinbase * (FF(1) - new_term.main_sel_op_coinbase)); + auto tmp = (new_term.main_sel_op_timestamp * (FF(1) - new_term.main_sel_op_timestamp)); tmp *= scaling_factor; std::get<10>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<11, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_timestamp * (FF(1) - new_term.main_sel_op_timestamp)); + auto tmp = (new_term.main_sel_op_fee_per_l2_gas * (FF(1) - new_term.main_sel_op_fee_per_l2_gas)); tmp *= scaling_factor; std::get<11>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<12, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fee_per_l2_gas * (FF(1) - new_term.main_sel_op_fee_per_l2_gas)); + auto tmp = (new_term.main_sel_op_fee_per_da_gas * (FF(1) - new_term.main_sel_op_fee_per_da_gas)); tmp *= scaling_factor; std::get<12>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<13, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fee_per_da_gas * (FF(1) - new_term.main_sel_op_fee_per_da_gas)); + auto tmp = (new_term.main_sel_op_l2gasleft * (FF(1) - new_term.main_sel_op_l2gasleft)); tmp *= scaling_factor; std::get<13>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<14, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l2gasleft * (FF(1) - new_term.main_sel_op_l2gasleft)); + auto tmp = (new_term.main_sel_op_dagasleft * (FF(1) - new_term.main_sel_op_dagasleft)); tmp *= scaling_factor; std::get<14>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<15, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_dagasleft * (FF(1) - new_term.main_sel_op_dagasleft)); + auto tmp = (new_term.main_sel_op_note_hash_exists * (FF(1) - new_term.main_sel_op_note_hash_exists)); tmp *= scaling_factor; std::get<15>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<16, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_note_hash_exists * (FF(1) - new_term.main_sel_op_note_hash_exists)); + auto tmp = (new_term.main_sel_op_emit_note_hash * (FF(1) - new_term.main_sel_op_emit_note_hash)); tmp *= scaling_factor; std::get<16>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<17, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_note_hash * (FF(1) - new_term.main_sel_op_emit_note_hash)); + auto tmp = (new_term.main_sel_op_nullifier_exists * (FF(1) - new_term.main_sel_op_nullifier_exists)); tmp *= scaling_factor; std::get<17>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<18, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_nullifier_exists * (FF(1) - new_term.main_sel_op_nullifier_exists)); + auto tmp = (new_term.main_sel_op_emit_nullifier * (FF(1) - new_term.main_sel_op_emit_nullifier)); tmp *= scaling_factor; std::get<18>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<19, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_nullifier * (FF(1) - new_term.main_sel_op_emit_nullifier)); + auto tmp = (new_term.main_sel_op_l1_to_l2_msg_exists * (FF(1) - new_term.main_sel_op_l1_to_l2_msg_exists)); tmp *= scaling_factor; std::get<19>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<20, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l1_to_l2_msg_exists * (FF(1) - new_term.main_sel_op_l1_to_l2_msg_exists)); + auto tmp = + (new_term.main_sel_op_emit_unencrypted_log * (FF(1) - new_term.main_sel_op_emit_unencrypted_log)); tmp *= scaling_factor; std::get<20>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<21, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_emit_unencrypted_log * (FF(1) - new_term.main_sel_op_emit_unencrypted_log)); + auto tmp = (new_term.main_sel_op_emit_l2_to_l1_msg * (FF(1) - new_term.main_sel_op_emit_l2_to_l1_msg)); tmp *= scaling_factor; std::get<21>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<22, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_l2_to_l1_msg * (FF(1) - new_term.main_sel_op_emit_l2_to_l1_msg)); + auto tmp = + (new_term.main_sel_op_get_contract_instance * (FF(1) - new_term.main_sel_op_get_contract_instance)); tmp *= scaling_factor; std::get<22>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<23, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_get_contract_instance * (FF(1) - new_term.main_sel_op_get_contract_instance)); + auto tmp = (new_term.main_sel_op_sload * (FF(1) - new_term.main_sel_op_sload)); tmp *= scaling_factor; std::get<23>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<24, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sload * (FF(1) - new_term.main_sel_op_sload)); + auto tmp = (new_term.main_sel_op_sstore * (FF(1) - new_term.main_sel_op_sstore)); tmp *= scaling_factor; std::get<24>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<25, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sstore * (FF(1) - new_term.main_sel_op_sstore)); + auto tmp = (new_term.main_sel_op_radix_le * (FF(1) - new_term.main_sel_op_radix_le)); tmp *= scaling_factor; std::get<25>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<26, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_radix_le * (FF(1) - new_term.main_sel_op_radix_le)); + auto tmp = (new_term.main_sel_op_sha256 * (FF(1) - new_term.main_sel_op_sha256)); tmp *= scaling_factor; std::get<26>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<27, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sha256 * (FF(1) - new_term.main_sel_op_sha256)); + auto tmp = (new_term.main_sel_op_poseidon2 * (FF(1) - new_term.main_sel_op_poseidon2)); tmp *= scaling_factor; std::get<27>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<28, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_poseidon2 * (FF(1) - new_term.main_sel_op_poseidon2)); + auto tmp = (new_term.main_sel_op_keccak * (FF(1) - new_term.main_sel_op_keccak)); tmp *= scaling_factor; std::get<28>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<29, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_keccak * (FF(1) - new_term.main_sel_op_keccak)); + auto tmp = (new_term.main_sel_op_pedersen * (FF(1) - new_term.main_sel_op_pedersen)); tmp *= scaling_factor; std::get<29>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<30, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_pedersen * (FF(1) - new_term.main_sel_op_pedersen)); + auto tmp = (new_term.main_sel_op_ecadd * (FF(1) - new_term.main_sel_op_ecadd)); tmp *= scaling_factor; std::get<30>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<31, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_ecadd * (FF(1) - new_term.main_sel_op_ecadd)); + auto tmp = (new_term.main_sel_op_pedersen_commit * (FF(1) - new_term.main_sel_op_pedersen_commit)); tmp *= scaling_factor; std::get<31>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<32, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_pedersen_commit * (FF(1) - new_term.main_sel_op_pedersen_commit)); + auto tmp = (new_term.main_sel_op_msm * (FF(1) - new_term.main_sel_op_msm)); tmp *= scaling_factor; std::get<32>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<33, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_msm * (FF(1) - new_term.main_sel_op_msm)); + auto tmp = (new_term.main_sel_op_add * (FF(1) - new_term.main_sel_op_add)); tmp *= scaling_factor; std::get<33>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<34, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_add * (FF(1) - new_term.main_sel_op_add)); + auto tmp = (new_term.main_sel_op_sub * (FF(1) - new_term.main_sel_op_sub)); tmp *= scaling_factor; std::get<34>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<35, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sub * (FF(1) - new_term.main_sel_op_sub)); + auto tmp = (new_term.main_sel_op_mul * (FF(1) - new_term.main_sel_op_mul)); tmp *= scaling_factor; std::get<35>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<36, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_mul * (FF(1) - new_term.main_sel_op_mul)); + auto tmp = (new_term.main_sel_op_div * (FF(1) - new_term.main_sel_op_div)); tmp *= scaling_factor; std::get<36>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<37, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_div * (FF(1) - new_term.main_sel_op_div)); + auto tmp = (new_term.main_sel_op_fdiv * (FF(1) - new_term.main_sel_op_fdiv)); tmp *= scaling_factor; std::get<37>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<38, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fdiv * (FF(1) - new_term.main_sel_op_fdiv)); + auto tmp = (new_term.main_sel_op_not * (FF(1) - new_term.main_sel_op_not)); tmp *= scaling_factor; std::get<38>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<39, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_not * (FF(1) - new_term.main_sel_op_not)); + auto tmp = (new_term.main_sel_op_eq * (FF(1) - new_term.main_sel_op_eq)); tmp *= scaling_factor; std::get<39>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<40, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_eq * (FF(1) - new_term.main_sel_op_eq)); + auto tmp = (new_term.main_sel_op_and * (FF(1) - new_term.main_sel_op_and)); tmp *= scaling_factor; std::get<40>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<41, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_and * (FF(1) - new_term.main_sel_op_and)); + auto tmp = (new_term.main_sel_op_or * (FF(1) - new_term.main_sel_op_or)); tmp *= scaling_factor; std::get<41>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<42, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_or * (FF(1) - new_term.main_sel_op_or)); + auto tmp = (new_term.main_sel_op_xor * (FF(1) - new_term.main_sel_op_xor)); tmp *= scaling_factor; std::get<42>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<43, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_xor * (FF(1) - new_term.main_sel_op_xor)); + auto tmp = (new_term.main_sel_op_cast * (FF(1) - new_term.main_sel_op_cast)); tmp *= scaling_factor; std::get<43>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<44, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_cast * (FF(1) - new_term.main_sel_op_cast)); + auto tmp = (new_term.main_sel_op_lt * (FF(1) - new_term.main_sel_op_lt)); tmp *= scaling_factor; std::get<44>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<45, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_lt * (FF(1) - new_term.main_sel_op_lt)); + auto tmp = (new_term.main_sel_op_lte * (FF(1) - new_term.main_sel_op_lte)); tmp *= scaling_factor; std::get<45>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<46, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_lte * (FF(1) - new_term.main_sel_op_lte)); + auto tmp = (new_term.main_sel_op_shl * (FF(1) - new_term.main_sel_op_shl)); tmp *= scaling_factor; std::get<46>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<47, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_shl * (FF(1) - new_term.main_sel_op_shl)); + auto tmp = (new_term.main_sel_op_shr * (FF(1) - new_term.main_sel_op_shr)); tmp *= scaling_factor; std::get<47>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<48, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_shr * (FF(1) - new_term.main_sel_op_shr)); + auto tmp = (new_term.main_sel_op_internal_call * (FF(1) - new_term.main_sel_op_internal_call)); tmp *= scaling_factor; std::get<48>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<49, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (FF(1) - new_term.main_sel_op_internal_call)); + auto tmp = (new_term.main_sel_op_internal_return * (FF(1) - new_term.main_sel_op_internal_return)); tmp *= scaling_factor; std::get<49>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<50, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * (FF(1) - new_term.main_sel_op_internal_return)); + auto tmp = (new_term.main_sel_op_jump * (FF(1) - new_term.main_sel_op_jump)); tmp *= scaling_factor; std::get<50>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<51, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jump * (FF(1) - new_term.main_sel_op_jump)); + auto tmp = (new_term.main_sel_op_jumpi * (FF(1) - new_term.main_sel_op_jumpi)); tmp *= scaling_factor; std::get<51>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<52, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jumpi * (FF(1) - new_term.main_sel_op_jumpi)); + auto tmp = (new_term.main_sel_op_external_call * (FF(1) - new_term.main_sel_op_external_call)); tmp *= scaling_factor; std::get<52>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<53, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_external_call * (FF(1) - new_term.main_sel_op_external_call)); + auto tmp = (new_term.main_sel_op_calldata_copy * (FF(1) - new_term.main_sel_op_calldata_copy)); tmp *= scaling_factor; std::get<53>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<54, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_calldata_copy * (FF(1) - new_term.main_sel_op_calldata_copy)); + auto tmp = (new_term.main_sel_op_external_return * (FF(1) - new_term.main_sel_op_external_return)); tmp *= scaling_factor; std::get<54>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<55, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_external_return * (FF(1) - new_term.main_sel_op_external_return)); + auto tmp = (new_term.main_sel_op_external_revert * (FF(1) - new_term.main_sel_op_external_revert)); tmp *= scaling_factor; std::get<55>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<56, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_external_revert * (FF(1) - new_term.main_sel_op_external_revert)); + auto tmp = (new_term.main_sel_op_set * (FF(1) - new_term.main_sel_op_set)); tmp *= scaling_factor; std::get<56>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<57, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_set * (FF(1) - new_term.main_sel_op_set)); + auto tmp = (new_term.main_sel_op_mov * (FF(1) - new_term.main_sel_op_mov)); tmp *= scaling_factor; std::get<57>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<58, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_mov * (FF(1) - new_term.main_sel_op_mov)); + auto tmp = (new_term.main_sel_op_cmov * (FF(1) - new_term.main_sel_op_cmov)); tmp *= scaling_factor; std::get<58>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<59, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_cmov * (FF(1) - new_term.main_sel_op_cmov)); + auto tmp = (new_term.main_op_err * (FF(1) - new_term.main_op_err)); tmp *= scaling_factor; std::get<59>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<60, ContainerOverSubrelations>; - auto tmp = (new_term.main_op_err * (FF(1) - new_term.main_op_err)); + auto tmp = (new_term.main_tag_err * (FF(1) - new_term.main_tag_err)); tmp *= scaling_factor; std::get<60>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<61, ContainerOverSubrelations>; - auto tmp = (new_term.main_tag_err * (FF(1) - new_term.main_tag_err)); + auto tmp = (new_term.main_id_zero * (FF(1) - new_term.main_id_zero)); tmp *= scaling_factor; std::get<61>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<62, ContainerOverSubrelations>; - auto tmp = (new_term.main_id_zero * (FF(1) - new_term.main_id_zero)); + auto tmp = (new_term.main_sel_mem_op_a * (FF(1) - new_term.main_sel_mem_op_a)); tmp *= scaling_factor; std::get<62>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<63, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_a * (FF(1) - new_term.main_sel_mem_op_a)); + auto tmp = (new_term.main_sel_mem_op_b * (FF(1) - new_term.main_sel_mem_op_b)); tmp *= scaling_factor; std::get<63>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<64, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_b * (FF(1) - new_term.main_sel_mem_op_b)); + auto tmp = (new_term.main_sel_mem_op_c * (FF(1) - new_term.main_sel_mem_op_c)); tmp *= scaling_factor; std::get<64>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<65, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_c * (FF(1) - new_term.main_sel_mem_op_c)); + auto tmp = (new_term.main_sel_mem_op_d * (FF(1) - new_term.main_sel_mem_op_d)); tmp *= scaling_factor; std::get<65>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<66, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_d * (FF(1) - new_term.main_sel_mem_op_d)); + auto tmp = (new_term.main_rwa * (FF(1) - new_term.main_rwa)); tmp *= scaling_factor; std::get<66>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<67, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwa * (FF(1) - new_term.main_rwa)); + auto tmp = (new_term.main_rwb * (FF(1) - new_term.main_rwb)); tmp *= scaling_factor; std::get<67>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<68, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwb * (FF(1) - new_term.main_rwb)); + auto tmp = (new_term.main_rwc * (FF(1) - new_term.main_rwc)); tmp *= scaling_factor; std::get<68>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<69, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwc * (FF(1) - new_term.main_rwc)); + auto tmp = (new_term.main_rwd * (FF(1) - new_term.main_rwd)); tmp *= scaling_factor; std::get<69>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<70, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwd * (FF(1) - new_term.main_rwd)); + auto tmp = (new_term.main_sel_resolve_ind_addr_a * (FF(1) - new_term.main_sel_resolve_ind_addr_a)); tmp *= scaling_factor; std::get<70>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<71, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_a * (FF(1) - new_term.main_sel_resolve_ind_addr_a)); + auto tmp = (new_term.main_sel_resolve_ind_addr_b * (FF(1) - new_term.main_sel_resolve_ind_addr_b)); tmp *= scaling_factor; std::get<71>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<72, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_b * (FF(1) - new_term.main_sel_resolve_ind_addr_b)); + auto tmp = (new_term.main_sel_resolve_ind_addr_c * (FF(1) - new_term.main_sel_resolve_ind_addr_c)); tmp *= scaling_factor; std::get<72>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<73, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_c * (FF(1) - new_term.main_sel_resolve_ind_addr_c)); + auto tmp = (new_term.main_sel_resolve_ind_addr_d * (FF(1) - new_term.main_sel_resolve_ind_addr_d)); tmp *= scaling_factor; std::get<73>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<74, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_d * (FF(1) - new_term.main_sel_resolve_ind_addr_d)); + auto tmp = (((new_term.main_sel_op_eq + new_term.main_sel_op_lte) + new_term.main_sel_op_lt) * + (new_term.main_w_in_tag - FF(1))); tmp *= scaling_factor; std::get<74>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<75, ContainerOverSubrelations>; - auto tmp = (((new_term.main_sel_op_eq + new_term.main_sel_op_lte) + new_term.main_sel_op_lt) * - (new_term.main_w_in_tag - FF(1))); + auto tmp = ((new_term.main_sel_op_fdiv * (FF(1) - new_term.main_op_err)) * + ((new_term.main_ic * new_term.main_ib) - new_term.main_ia)); tmp *= scaling_factor; std::get<75>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<76, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_fdiv * (FF(1) - new_term.main_op_err)) * - ((new_term.main_ic * new_term.main_ib) - new_term.main_ia)); + auto tmp = ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * + (((new_term.main_ib * new_term.main_inv) - FF(1)) + new_term.main_op_err)); tmp *= scaling_factor; std::get<76>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<77, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * - (((new_term.main_ib * new_term.main_inv) - FF(1)) + new_term.main_op_err)); + auto tmp = (((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * new_term.main_op_err) * + (FF(1) - new_term.main_inv)); tmp *= scaling_factor; std::get<77>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<78, ContainerOverSubrelations>; - auto tmp = (((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * new_term.main_op_err) * - (FF(1) - new_term.main_inv)); + auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_r_in_tag - FF(6))); tmp *= scaling_factor; std::get<78>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<79, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_r_in_tag - FF(6))); + auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_w_in_tag - FF(6))); tmp *= scaling_factor; std::get<79>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<80, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_w_in_tag - FF(6))); + auto tmp = (new_term.main_op_err * ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) - FF(1))); tmp *= scaling_factor; std::get<80>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<81, ContainerOverSubrelations>; - auto tmp = (new_term.main_op_err * ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) - FF(1))); + auto tmp = (new_term.main_sel_op_jump * (new_term.main_pc_shift - new_term.main_ia)); tmp *= scaling_factor; std::get<81>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<82, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jump * (new_term.main_pc_shift - new_term.main_ia)); + auto tmp = (new_term.main_sel_op_jumpi * + (((FF(1) - new_term.main_id_zero) * (new_term.main_pc_shift - new_term.main_ia)) + + (new_term.main_id_zero * ((new_term.main_pc_shift - new_term.main_pc) - FF(1))))); tmp *= scaling_factor; std::get<82>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<83, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jumpi * - (((FF(1) - new_term.main_id_zero) * (new_term.main_pc_shift - new_term.main_ia)) + - (new_term.main_id_zero * ((new_term.main_pc_shift - new_term.main_pc) - FF(1))))); + auto tmp = (new_term.main_sel_op_internal_call * + (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr + FF(1)))); tmp *= scaling_factor; std::get<83>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<84, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * - (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr + FF(1)))); + auto tmp = + (new_term.main_sel_op_internal_call * (new_term.main_internal_return_ptr - new_term.main_mem_addr_b)); tmp *= scaling_factor; std::get<84>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<85, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_internal_call * (new_term.main_internal_return_ptr - new_term.main_mem_addr_b)); + auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_pc_shift - new_term.main_ia)); tmp *= scaling_factor; std::get<85>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<86, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_pc_shift - new_term.main_ia)); + auto tmp = (new_term.main_sel_op_internal_call * ((new_term.main_pc + FF(1)) - new_term.main_ib)); tmp *= scaling_factor; std::get<86>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<87, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * ((new_term.main_pc + FF(1)) - new_term.main_ib)); + auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_rwb - FF(1))); tmp *= scaling_factor; std::get<87>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<88, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_rwb - FF(1))); + auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_sel_mem_op_b - FF(1))); tmp *= scaling_factor; std::get<88>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<89, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_sel_mem_op_b - FF(1))); + auto tmp = (new_term.main_sel_op_internal_return * + (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr - FF(1)))); tmp *= scaling_factor; std::get<89>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<90, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_internal_return * - (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr - FF(1)))); + ((new_term.main_internal_return_ptr - FF(1)) - new_term.main_mem_addr_a)); tmp *= scaling_factor; std::get<90>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<91, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * - ((new_term.main_internal_return_ptr - FF(1)) - new_term.main_mem_addr_a)); + auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_pc_shift - new_term.main_ia)); tmp *= scaling_factor; std::get<91>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<92, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_pc_shift - new_term.main_ia)); + auto tmp = (new_term.main_sel_op_internal_return * new_term.main_rwa); tmp *= scaling_factor; std::get<92>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<93, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * new_term.main_rwa); + auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_sel_mem_op_a - FF(1))); tmp *= scaling_factor; std::get<93>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<94, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_sel_mem_op_a - FF(1))); + auto tmp = ((main_CUR_AND_NEXT_ARE_MAIN * (FF(1) - main_SEL_ALL_CTRL_FLOW)) * + (new_term.main_pc_shift - (new_term.main_pc + FF(1)))); tmp *= scaling_factor; std::get<94>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<95, ContainerOverSubrelations>; auto tmp = ((main_CUR_AND_NEXT_ARE_MAIN * (FF(1) - main_SEL_ALL_CTRL_FLOW)) * - (new_term.main_pc_shift - (new_term.main_pc + FF(1)))); + (new_term.main_internal_return_ptr_shift - new_term.main_internal_return_ptr)); tmp *= scaling_factor; std::get<95>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<96, ContainerOverSubrelations>; - auto tmp = ((main_CUR_AND_NEXT_ARE_MAIN * (FF(1) - main_SEL_ALL_CTRL_FLOW)) * - (new_term.main_internal_return_ptr_shift - new_term.main_internal_return_ptr)); + auto tmp = ((new_term.main_sel_op_internal_call + new_term.main_sel_op_internal_return) * + (new_term.main_space_id - constants_misc_INTERNAL_CALL_SPACE_ID)); tmp *= scaling_factor; std::get<96>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<97, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_internal_call + new_term.main_sel_op_internal_return) * - (new_term.main_space_id - constants_misc_INTERNAL_CALL_SPACE_ID)); + auto tmp = (((FF(1) - new_term.main_sel_op_internal_call) - new_term.main_sel_op_internal_return) * + (new_term.main_call_ptr - new_term.main_space_id)); tmp *= scaling_factor; std::get<97>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<98, ContainerOverSubrelations>; - auto tmp = (((FF(1) - new_term.main_sel_op_internal_call) - new_term.main_sel_op_internal_return) * - (new_term.main_call_ptr - new_term.main_space_id)); + auto tmp = ((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * + (((new_term.main_id * new_term.main_inv) - FF(1)) + new_term.main_id_zero)); tmp *= scaling_factor; std::get<98>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<99, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * - (((new_term.main_id * new_term.main_inv) - FF(1)) + new_term.main_id_zero)); + auto tmp = (((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * new_term.main_id_zero) * + (FF(1) - new_term.main_inv)); tmp *= scaling_factor; std::get<99>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<100, ContainerOverSubrelations>; - auto tmp = (((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * new_term.main_id_zero) * - (FF(1) - new_term.main_inv)); + auto tmp = (new_term.main_sel_mov_ia_to_ic - + (new_term.main_sel_op_mov + (new_term.main_sel_op_cmov * (FF(1) - new_term.main_id_zero)))); tmp *= scaling_factor; std::get<100>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<101, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ia_to_ic - - (new_term.main_sel_op_mov + (new_term.main_sel_op_cmov * (FF(1) - new_term.main_id_zero)))); + auto tmp = (new_term.main_sel_mov_ib_to_ic - (new_term.main_sel_op_cmov * new_term.main_id_zero)); tmp *= scaling_factor; std::get<101>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<102, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ib_to_ic - (new_term.main_sel_op_cmov * new_term.main_id_zero)); + auto tmp = (new_term.main_sel_mov_ia_to_ic * (new_term.main_ia - new_term.main_ic)); tmp *= scaling_factor; std::get<102>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<103, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ia_to_ic * (new_term.main_ia - new_term.main_ic)); + auto tmp = (new_term.main_sel_mov_ib_to_ic * (new_term.main_ib - new_term.main_ic)); tmp *= scaling_factor; std::get<103>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<104, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ib_to_ic * (new_term.main_ib - new_term.main_ic)); + auto tmp = ((new_term.main_sel_op_mov + new_term.main_sel_op_cmov) * + (new_term.main_r_in_tag - new_term.main_w_in_tag)); tmp *= scaling_factor; std::get<104>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<105, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_mov + new_term.main_sel_op_cmov) * - (new_term.main_r_in_tag - new_term.main_w_in_tag)); + auto tmp = (new_term.main_sel_alu - + ((main_SEL_ALL_ALU * (FF(1) - new_term.main_tag_err)) * (FF(1) - new_term.main_op_err))); tmp *= scaling_factor; std::get<105>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<106, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_alu - - ((main_SEL_ALL_ALU * (FF(1) - new_term.main_tag_err)) * (FF(1) - new_term.main_op_err))); + auto tmp = (main_SEL_ALU_R_TAG * (new_term.main_alu_in_tag - new_term.main_r_in_tag)); tmp *= scaling_factor; std::get<106>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<107, ContainerOverSubrelations>; - auto tmp = (main_SEL_ALU_R_TAG * (new_term.main_alu_in_tag - new_term.main_r_in_tag)); + auto tmp = (main_SEL_ALU_W_TAG * (new_term.main_alu_in_tag - new_term.main_w_in_tag)); tmp *= scaling_factor; std::get<107>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<108, ContainerOverSubrelations>; - auto tmp = (main_SEL_ALU_W_TAG * (new_term.main_alu_in_tag - new_term.main_w_in_tag)); + auto tmp = (new_term.main_sel_op_l2gasleft * (new_term.main_ia - new_term.main_l2_gas_remaining_shift)); tmp *= scaling_factor; std::get<108>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<109, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l2gasleft * (new_term.main_ia - new_term.main_l2_gas_remaining_shift)); + auto tmp = (new_term.main_sel_op_dagasleft * (new_term.main_ia - new_term.main_da_gas_remaining_shift)); tmp *= scaling_factor; std::get<109>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<110, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_dagasleft * (new_term.main_ia - new_term.main_da_gas_remaining_shift)); - tmp *= scaling_factor; - std::get<110>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<111, ContainerOverSubrelations>; auto tmp = ((new_term.main_ib * (FF(1) - new_term.main_tag_err)) * ((new_term.main_sel_op_calldata_copy + new_term.main_sel_op_external_return) - new_term.main_sel_slice_gadget)); tmp *= scaling_factor; - std::get<111>(evals) += typename Accumulator::View(tmp); + std::get<110>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<112, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<111, ContainerOverSubrelations>; auto tmp = (new_term.main_bin_op_id - (new_term.main_sel_op_or + (FF(2) * new_term.main_sel_op_xor))); tmp *= scaling_factor; - std::get<112>(evals) += typename Accumulator::View(tmp); + std::get<111>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<113, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<112, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_bin - ((new_term.main_sel_op_and + new_term.main_sel_op_or) + new_term.main_sel_op_xor)); tmp *= scaling_factor; - std::get<113>(evals) += typename Accumulator::View(tmp); + std::get<112>(evals) += typename Accumulator::View(tmp); } } }; @@ -806,53 +798,53 @@ template class main : public Relation> { switch (index) { case 0: return "OPCODE_SELECTORS"; - case 75: + case 74: return "OUTPUT_U8"; - case 76: + case 75: return "SUBOP_FDIV"; - case 77: + case 76: return "SUBOP_FDIV_ZERO_ERR1"; - case 78: + case 77: return "SUBOP_FDIV_ZERO_ERR2"; - case 79: + case 78: return "SUBOP_FDIV_R_IN_TAG_FF"; - case 80: + case 79: return "SUBOP_FDIV_W_IN_TAG_FF"; - case 81: + case 80: return "SUBOP_ERROR_RELEVANT_OP"; - case 82: + case 81: return "PC_JUMP"; - case 83: + case 82: return "PC_JUMPI"; - case 84: + case 83: return "RETURN_POINTER_INCREMENT"; - case 90: + case 89: return "RETURN_POINTER_DECREMENT"; - case 95: + case 94: return "PC_INCREMENT"; - case 96: + case 95: return "INTERNAL_RETURN_POINTER_CONSISTENCY"; - case 97: + case 96: return "SPACE_ID_INTERNAL"; - case 98: + case 97: return "SPACE_ID_STANDARD_OPCODES"; - case 99: + case 98: return "CMOV_CONDITION_RES_1"; - case 100: + case 99: return "CMOV_CONDITION_RES_2"; - case 103: + case 102: return "MOV_SAME_VALUE_A"; - case 104: + case 103: return "MOV_SAME_VALUE_B"; - case 105: + case 104: return "MOV_MAIN_SAME_TAG"; - case 109: + case 108: return "L2GASLEFT"; - case 110: + case 109: return "DAGASLEFT"; - case 112: + case 111: return "BIN_SEL_1"; - case 113: + case 112: return "BIN_SEL_2"; } return std::to_string(index); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp index 5cd4535a260..b665f5c039c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp @@ -1394,135 +1394,124 @@ TEST_F(AvmExecutionTests, kernelInputOpcodes) std::string bytecode_hex = to_hex(OpCode::ADDRESS) + // opcode ADDRESS "00" // Indirect flag "00000001" // dst_offset - + to_hex(OpCode::STORAGEADDRESS) + // opcode STORAGEADDRESS - "00" // Indirect flag - "00000002" // dst_offset + to_hex(OpCode::SENDER) + // opcode SENDER "00" // Indirect flag - "00000003" // dst_offset + "00000002" // dst_offset + to_hex(OpCode::FUNCTIONSELECTOR) + // opcode TRANSACTIONFEE "00" // Indirect flag - "00000004" // dst_offset + "00000003" // dst_offset + to_hex(OpCode::TRANSACTIONFEE) + // opcode TRANSACTIONFEE "00" // Indirect flag - "00000005" // dst_offset + "00000004" // dst_offset + to_hex(OpCode::CHAINID) + // opcode CHAINID "00" // Indirect flag - "00000006" // dst_offset + "00000005" // dst_offset + to_hex(OpCode::VERSION) + // opcode VERSION "00" // Indirect flag - "00000007" // dst_offset + "00000006" // dst_offset + to_hex(OpCode::BLOCKNUMBER) + // opcode BLOCKNUMBER "00" // Indirect flag - "00000008" // dst_offset + "00000007" // dst_offset + to_hex(OpCode::TIMESTAMP) + // opcode TIMESTAMP "00" // Indirect flag - "00000009" // dst_offset + "00000008" // dst_offset // Not in simulator // + to_hex(OpCode::COINBASE) + // opcode COINBASE // "00" // Indirect flag - // "00000009" // dst_offset + // "00000008" // dst_offset + to_hex(OpCode::FEEPERL2GAS) + // opcode FEEPERL2GAS "00" // Indirect flag - "0000000a" // dst_offset + "00000009" // dst_offset + to_hex(OpCode::FEEPERDAGAS) + // opcode FEEPERDAGAS "00" // Indirect flag - "0000000b" // dst_offset + "0000000a" // dst_offset + to_hex(OpCode::RETURN) + // opcode RETURN "00" // Indirect flag "00000001" // ret offset 1 - "0000000b"; // ret size 11 + "0000000a"; // ret size 11 auto bytecode = hex_to_bytes(bytecode_hex); auto instructions = Deserialization::parse(bytecode); - ASSERT_THAT(instructions, SizeIs(12)); + ASSERT_THAT(instructions, SizeIs(11)); // ADDRESS EXPECT_THAT(instructions.at(0), AllOf(Field(&Instruction::op_code, OpCode::ADDRESS), Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(1))))); - // STORAGEADDRESS - EXPECT_THAT(instructions.at(1), - AllOf(Field(&Instruction::op_code, OpCode::STORAGEADDRESS), - Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(2))))); - // SENDER - EXPECT_THAT(instructions.at(2), + EXPECT_THAT(instructions.at(1), AllOf(Field(&Instruction::op_code, OpCode::SENDER), - Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(3))))); + Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(2))))); // FUNCTIONSELECTOR - EXPECT_THAT(instructions.at(3), + EXPECT_THAT(instructions.at(2), AllOf(Field(&Instruction::op_code, OpCode::FUNCTIONSELECTOR), - Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(4))))); + Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(3))))); // TRANSACTIONFEE - EXPECT_THAT(instructions.at(4), + EXPECT_THAT(instructions.at(3), AllOf(Field(&Instruction::op_code, OpCode::TRANSACTIONFEE), - Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(5))))); + Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(4))))); // CHAINID - EXPECT_THAT(instructions.at(5), + EXPECT_THAT(instructions.at(4), AllOf(Field(&Instruction::op_code, OpCode::CHAINID), - Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(6))))); + Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(5))))); // VERSION - EXPECT_THAT(instructions.at(6), + EXPECT_THAT(instructions.at(5), AllOf(Field(&Instruction::op_code, OpCode::VERSION), - Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(7))))); + Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(6))))); // BLOCKNUMBER - EXPECT_THAT(instructions.at(7), + EXPECT_THAT(instructions.at(6), AllOf(Field(&Instruction::op_code, OpCode::BLOCKNUMBER), - Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(8))))); + Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(7))))); // TIMESTAMP - EXPECT_THAT(instructions.at(8), + EXPECT_THAT(instructions.at(7), AllOf(Field(&Instruction::op_code, OpCode::TIMESTAMP), - Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(9))))); + Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(8))))); // COINBASE // Not in simulator - // EXPECT_THAT(instructions.at(8), + // EXPECT_THAT(instructions.at(7), // AllOf(Field(&Instruction::op_code, OpCode::COINBASE), // Field(&Instruction::operands, ElementsAre(VariantWith(0), // VariantWith(10))))); // FEEPERL2GAS - EXPECT_THAT(instructions.at(9), + EXPECT_THAT(instructions.at(8), AllOf(Field(&Instruction::op_code, OpCode::FEEPERL2GAS), - Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(10))))); + Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(9))))); // FEEPERDAGAS - EXPECT_THAT(instructions.at(10), + EXPECT_THAT(instructions.at(9), AllOf(Field(&Instruction::op_code, OpCode::FEEPERDAGAS), - Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(11))))); + Field(&Instruction::operands, ElementsAre(VariantWith(0), VariantWith(10))))); // Public inputs for the circuit std::vector calldata = {}; FF sender = 1; FF address = 2; - // NOTE: address doesn't actually exist in public circuit public inputs, - // so storage address is just an alias of address for now - FF storage_address = address; - FF function_selector = 4; - FF transaction_fee = 5; - FF chainid = 6; - FF version = 7; - FF blocknumber = 8; - FF timestamp = 9; + FF function_selector = 3; + FF transaction_fee = 4; + FF chainid = 5; + FF version = 6; + FF blocknumber = 7; + FF timestamp = 8; // FF coinbase = 10; // Not in simulator - FF feeperl2gas = 10; - FF feeperdagas = 11; + FF feeperl2gas = 9; + FF feeperdagas = 10; // The return data for this test should be a the opcodes in sequence, as the opcodes dst address lines up with // this array The returndata call above will then return this array std::vector const expected_returndata = { - address, storage_address, sender, function_selector, transaction_fee, chainid, version, - blocknumber, /*coinbase,*/ timestamp, feeperl2gas, feeperdagas, + address, sender, function_selector, transaction_fee, chainid, + version, blocknumber, /*coinbase,*/ timestamp, feeperl2gas, feeperdagas, }; // Set up public inputs to contain the above values @@ -1530,7 +1519,6 @@ TEST_F(AvmExecutionTests, kernelInputOpcodes) // Reduce the amount of times we have similar code to this // public_inputs_vec[ADDRESS_SELECTOR] = address; - public_inputs_vec[STORAGE_ADDRESS_SELECTOR] = storage_address; public_inputs_vec[SENDER_SELECTOR] = sender; public_inputs_vec[FUNCTION_SELECTOR_SELECTOR] = function_selector; public_inputs_vec[TRANSACTION_FEE_OFFSET] = transaction_fee; @@ -1558,11 +1546,6 @@ TEST_F(AvmExecutionTests, kernelInputOpcodes) std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_address == 1; }); EXPECT_EQ(address_row->main_ia, address); - // Check storage address - auto storage_addr_row = - std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_storage_address == 1; }); - EXPECT_EQ(storage_addr_row->main_ia, storage_address); - // Check sender auto sender_row = std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_sender == 1; }); EXPECT_EQ(sender_row->main_ia, sender); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/kernel.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/kernel.test.cpp index 87e503fe105..caf3d39a47c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/kernel.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/kernel.test.cpp @@ -251,40 +251,6 @@ TEST_F(AvmKernelPositiveTests, kernelAddress) test_kernel_lookup(true, indirect_apply_opcodes, checks); } -TEST_F(AvmKernelPositiveTests, kernelStorageAddress) -{ - uint32_t dst_offset = 42; - uint32_t indirect_dst_offset = 69; - auto direct_apply_opcodes = [=](AvmTraceBuilder& trace_builder) { - trace_builder.op_storage_address(/*indirect*/ false, dst_offset); - }; - auto indirect_apply_opcodes = [=](AvmTraceBuilder& trace_builder) { - trace_builder.op_set( - /*indirect*/ false, - /*value*/ dst_offset, - /*dst_offset*/ indirect_dst_offset, - AvmMemoryTag::U32); - trace_builder.op_storage_address(/*indirect*/ true, indirect_dst_offset); - }; - - auto checks = [=](bool indirect, const std::vector& trace) { - auto storage_address_row = std::ranges::find_if( - trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_storage_address == FF(1); }); - EXPECT_TRUE(storage_address_row != trace.end()); - - expect_row(storage_address_row, - /*kernel_in_offset=*/STORAGE_ADDRESS_SELECTOR, - /*ia=*/STORAGE_ADDRESS_SELECTOR + - 1, // Note the value generated above for public inputs is the same as the index read + 1 - /*ind_a*/ indirect ? indirect_dst_offset : 0, - /*mem_addr_a=*/dst_offset, - /*w_in_tag=*/AvmMemoryTag::FF); - }; - - test_kernel_lookup(false, direct_apply_opcodes, checks); - test_kernel_lookup(true, indirect_apply_opcodes, checks); -} - TEST_F(AvmKernelPositiveTests, kernelFunctionSelector) { // Direct @@ -679,32 +645,6 @@ TEST_F(AvmKernelNegativeTests, incorrectIaAddress) negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP); } -TEST_F(AvmKernelNegativeTests, incorrectIaStorageAddress) -{ - uint32_t dst_offset = 42; - FF incorrect_ia = FF(69); - - // We test that the sender opcode is inlcuded at index x in the public inputs - auto apply_opcodes = [=](AvmTraceBuilder& trace_builder) { - trace_builder.op_storage_address(/*indirect*/ false, dst_offset); - }; - auto checks = [=](bool indirect, const std::vector& trace) { - auto row = std::ranges::find_if( - trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_storage_address == FF(1); }); - EXPECT_TRUE(row != trace.end()); - - expect_row( - row, - /*kernel_in_offset=*/STORAGE_ADDRESS_SELECTOR, - /*ia=*/incorrect_ia, // Note the value generated above for public inputs is the same as the index read + 1 - /*ind_a*/ indirect, - /*mem_addr_a=*/dst_offset, - /*w_in_tag=*/AvmMemoryTag::FF); - }; - - negative_test_incorrect_ia_kernel_lookup(apply_opcodes, checks, incorrect_ia, BAD_LOOKUP); -} - TEST_F(AvmKernelNegativeTests, incorrectIaFunctionSelector) { uint32_t dst_offset = 42; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/deserialization.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/deserialization.cpp index 7302d4747c3..dbc59a3535c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/deserialization.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/deserialization.cpp @@ -60,7 +60,6 @@ const std::unordered_map> OPCODE_WIRE_FORMAT = // Execution Environment - Globals { OpCode::ADDRESS, getter_format }, - { OpCode::STORAGEADDRESS, getter_format }, { OpCode::SENDER, getter_format }, { OpCode::FUNCTIONSELECTOR, getter_format }, { OpCode::TRANSACTIONFEE, getter_format }, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp index fc53843c31d..c4b8c149e1f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp @@ -203,10 +203,8 @@ VmPublicInputs Execution::convert_public_inputs(std::vector const& public_in // Copy items from PublicCircuitPublicInputs vector to public input columns // PublicCircuitPublicInputs - CallContext - kernel_inputs[SENDER_SELECTOR] = public_inputs_vec[SENDER_SELECTOR]; // Sender - // NOTE: address has same position as storage address (they are the same for now...) - // kernel_inputs[ADDRESS_SELECTOR] = public_inputs_vec[ADDRESS_SELECTOR]; // Address - kernel_inputs[STORAGE_ADDRESS_SELECTOR] = public_inputs_vec[STORAGE_ADDRESS_SELECTOR]; // Storage Address + kernel_inputs[SENDER_SELECTOR] = public_inputs_vec[SENDER_SELECTOR]; // Sender + kernel_inputs[ADDRESS_SELECTOR] = public_inputs_vec[ADDRESS_SELECTOR]; // Address kernel_inputs[FUNCTION_SELECTOR_SELECTOR] = public_inputs_vec[FUNCTION_SELECTOR_SELECTOR]; // PublicCircuitPublicInputs - GlobalVariables @@ -518,10 +516,6 @@ std::vector Execution::gen_trace(std::vector const& instructio case OpCode::ADDRESS: trace_builder.op_address(std::get(inst.operands.at(0)), std::get(inst.operands.at(1))); break; - case OpCode::STORAGEADDRESS: - trace_builder.op_storage_address(std::get(inst.operands.at(0)), - std::get(inst.operands.at(1))); - break; case OpCode::SENDER: trace_builder.op_sender(std::get(inst.operands.at(0)), std::get(inst.operands.at(1))); break; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp index 9db455bd62c..4c94f98adbf 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp @@ -34,7 +34,6 @@ const std::unordered_map GAS_COST_TABLE = { { OpCode::SHR, make_cost(AVM_SHR_BASE_L2_GAS, 0, AVM_SHR_DYN_L2_GAS, 0) }, { OpCode::CAST, make_cost(AVM_CAST_BASE_L2_GAS, 0, AVM_CAST_DYN_L2_GAS, 0) }, { OpCode::ADDRESS, make_cost(AVM_ADDRESS_BASE_L2_GAS, 0, AVM_ADDRESS_DYN_L2_GAS, 0) }, - { OpCode::STORAGEADDRESS, make_cost(AVM_STORAGEADDRESS_BASE_L2_GAS, 0, AVM_STORAGEADDRESS_DYN_L2_GAS, 0) }, { OpCode::SENDER, make_cost(AVM_SENDER_BASE_L2_GAS, 0, AVM_SENDER_DYN_L2_GAS, 0) }, { OpCode::FUNCTIONSELECTOR, make_cost(AVM_FUNCTIONSELECTOR_BASE_L2_GAS, 0, AVM_FUNCTIONSELECTOR_DYN_L2_GAS, 0) }, { OpCode::TRANSACTIONFEE, make_cost(AVM_TRANSACTIONFEE_BASE_L2_GAS, 0, AVM_TRANSACTIONFEE_DYN_L2_GAS, 0) }, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/kernel_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/kernel_trace.cpp index 8564a7eed2b..0ffd8003ee5 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/kernel_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/kernel_trace.cpp @@ -54,16 +54,6 @@ FF AvmKernelTraceBuilder::op_address(uint32_t clk) return perform_kernel_input_lookup(ADDRESS_SELECTOR); } -FF AvmKernelTraceBuilder::op_storage_address(uint32_t clk) -{ - KernelTraceEntry entry = { - .clk = clk, - .operation = KernelTraceOpType::STORAGE_ADDRESS, - }; - kernel_trace.push_back(entry); - return perform_kernel_input_lookup(STORAGE_ADDRESS_SELECTOR); -} - FF AvmKernelTraceBuilder::op_sender(uint32_t clk) { KernelTraceEntry entry = { @@ -347,10 +337,6 @@ void AvmKernelTraceBuilder::finalize(std::vector>& main_trace) dest.main_kernel_in_offset = ADDRESS_SELECTOR; dest.main_sel_q_kernel_lookup = 1; break; - case KernelTraceOpType::STORAGE_ADDRESS: - dest.main_kernel_in_offset = STORAGE_ADDRESS_SELECTOR; - dest.main_sel_q_kernel_lookup = 1; - break; case KernelTraceOpType::SENDER: dest.main_kernel_in_offset = SENDER_SELECTOR; dest.main_sel_q_kernel_lookup = 1; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/kernel_trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/kernel_trace.hpp index 773d68bba3f..7e2f087a473 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/kernel_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/kernel_trace.hpp @@ -17,7 +17,6 @@ class AvmKernelTraceBuilder { enum class KernelTraceOpType { // IN ADDRESS, - STORAGE_ADDRESS, SENDER, FUNCTION_SELECTOR, TRANSACTION_FEE, @@ -69,7 +68,6 @@ class AvmKernelTraceBuilder { // Context FF op_address(uint32_t clk); - FF op_storage_address(uint32_t clk); FF op_sender(uint32_t clk); FF op_function_selector(uint32_t clk); FF op_transaction_fee(uint32_t clk); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.cpp index b5f001a7c51..db846f3da9b 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.cpp @@ -62,8 +62,6 @@ std::string to_string(OpCode opcode) // Execution Environment case OpCode::ADDRESS: return "ADDRESS"; - case OpCode::STORAGEADDRESS: - return "STORAGEADDRESS"; case OpCode::SENDER: return "SENDER"; case OpCode::FUNCTIONSELECTOR: diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.hpp index 6c6c781801b..33a598d2f87 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/opcode.hpp @@ -43,7 +43,6 @@ enum class OpCode : uint8_t { // Execution Environment ADDRESS, - STORAGEADDRESS, SENDER, FUNCTIONSELECTOR, TRANSACTIONFEE, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp index 899d4dd2575..e3ea0ac5212 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp @@ -1273,19 +1273,6 @@ void AvmTraceBuilder::op_address(uint8_t indirect, uint32_t dst_offset) main_trace.push_back(row); } -void AvmTraceBuilder::op_storage_address(uint8_t indirect, uint32_t dst_offset) -{ - auto const clk = static_cast(main_trace.size()) + 1; - FF ia_value = kernel_trace_builder.op_storage_address(clk); - Row row = create_kernel_lookup_opcode(indirect, dst_offset, ia_value, AvmMemoryTag::FF); - row.main_sel_op_storage_address = FF(1); - - // Constrain gas cost - gas_trace_builder.constrain_gas(static_cast(row.main_clk), OpCode::STORAGEADDRESS); - - main_trace.push_back(row); -} - void AvmTraceBuilder::op_sender(uint8_t indirect, uint32_t dst_offset) { auto const clk = static_cast(main_trace.size()) + 1; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.hpp index 5140d76bd37..b3e28fd29cf 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.hpp @@ -84,7 +84,6 @@ class AvmTraceBuilder { // Execution Environment void op_address(uint8_t indirect, uint32_t dst_offset); - void op_storage_address(uint8_t indirect, uint32_t dst_offset); void op_sender(uint8_t indirect, uint32_t dst_offset); void op_function_selector(uint8_t indirect, uint32_t dst_offset); void op_transaction_fee(uint8_t indirect, uint32_t dst_offset); diff --git a/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp b/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp index 3bcd64e7c0e..36b35b7cf43 100644 --- a/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp @@ -36,7 +36,6 @@ #define AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS 66 #define SENDER_SELECTOR 0 #define ADDRESS_SELECTOR 1 -#define STORAGE_ADDRESS_SELECTOR 1 #define FUNCTION_SELECTOR_SELECTOR 2 #define START_GLOBAL_VARIABLES 29 #define CHAIN_ID_SELECTOR 29 @@ -77,7 +76,6 @@ #define AVM_SHR_BASE_L2_GAS 320 #define AVM_CAST_BASE_L2_GAS 300 #define AVM_ADDRESS_BASE_L2_GAS 200 -#define AVM_STORAGEADDRESS_BASE_L2_GAS 200 #define AVM_SENDER_BASE_L2_GAS 200 #define AVM_FUNCTIONSELECTOR_BASE_L2_GAS 200 #define AVM_TRANSACTIONFEE_BASE_L2_GAS 200 @@ -142,7 +140,6 @@ #define AVM_SHR_DYN_L2_GAS 0 #define AVM_CAST_DYN_L2_GAS 0 #define AVM_ADDRESS_DYN_L2_GAS 0 -#define AVM_STORAGEADDRESS_DYN_L2_GAS 0 #define AVM_SENDER_DYN_L2_GAS 0 #define AVM_FUNCTIONSELECTOR_DYN_L2_GAS 0 #define AVM_TRANSACTIONFEE_DYN_L2_GAS 0 diff --git a/docs/docs/protocol-specs/public-vm/_nested-context.md b/docs/docs/protocol-specs/public-vm/_nested-context.md index 177a5683628..ca3193d61bf 100644 --- a/docs/docs/protocol-specs/public-vm/_nested-context.md +++ b/docs/docs/protocol-specs/public-vm/_nested-context.md @@ -14,7 +14,6 @@ Nested context derivation is defined as follows: ```jsx nestedExecutionEnvironment = ExecutionEnvironment { address: M[addrOffset], - storageAddress: M[addrOffset], sender: context.address, functionSelector: context.environment.functionSelector, transactionFee: context.environment.transactionFee, diff --git a/docs/docs/protocol-specs/public-vm/avm-circuit.md b/docs/docs/protocol-specs/public-vm/avm-circuit.md index dbfa91ca647..6336cedef10 100644 --- a/docs/docs/protocol-specs/public-vm/avm-circuit.md +++ b/docs/docs/protocol-specs/public-vm/avm-circuit.md @@ -182,7 +182,6 @@ AvmSessionInputs { feePerDaGas: field, globals: PublicGlobalVariables, address: AztecAddress, - storageAddress: AztecAddress, sender: AztecAddress, contractCallDepth: field, isStaticCall: boolean, diff --git a/docs/docs/protocol-specs/public-vm/context.mdx b/docs/docs/protocol-specs/public-vm/context.mdx index 95486b39576..776d27337b2 100644 --- a/docs/docs/protocol-specs/public-vm/context.mdx +++ b/docs/docs/protocol-specs/public-vm/context.mdx @@ -26,7 +26,6 @@ A context's **execution environment** remains constant throughout a contract cal | Field | Type | Description | | ------------------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | address | `AztecAddress` | | -| storageAddress | `AztecAddress` | | | sender | `AztecAddress` | | | functionSelector | `u32` | | | transactionFee | `field` | Computed transaction fee based on gas fees, inclusion fee, and gas usage. Zero in all phases but teardown. | @@ -71,7 +70,6 @@ Given a [`PublicCallRequest`](../transactions/tx-object#public-call-request) and ``` INITIAL_EXECUTION_ENVIRONMENT = ExecutionEnvironment { address: PublicCallRequest.contractAddress, - storageAddress: PublicCallRequest.CallContext.storageContractAddress, sender: PublicCallRequest.CallContext.msgSender, functionelector: PublicCallRequest.functionSelector, contractCallDepth: 0, @@ -95,7 +93,6 @@ INITIAL_WORLD_STATE_ACCESS_TRACE = WorldStateAccessTrace { TracedContractCall { callPointer: nestedContext.environment.callPointer, address: nestedContext.address, - storageAddress: nestedContext.storageAddress, counter: 0, endLifetime: 0, // The call's end-lifetime will be updated later if it or its caller reverts } diff --git a/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx b/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx index 04fa4cd5c7c..4c861c70069 100644 --- a/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx +++ b/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx @@ -143,14 +143,6 @@ Click on an instruction name to jump to its section. 0x10 - \[\`STORAGEADDRESS\`\](#isa-section-storageaddress) - Get the _storage_ address of the currently executing context - { - `M[dstOffset] = context.environment.storageAddress` - } - - - 0x11 \[\`SENDER\`\](#isa-section-sender) Get the address of the sender (caller of the current context) { @@ -158,7 +150,7 @@ Click on an instruction name to jump to its section. } - 0x12 + 0x11 \[\`FUNCTIONSELECTOR\`\](#isa-section-functionselector) Get the function selector of the contract function being executed { @@ -166,7 +158,7 @@ Click on an instruction name to jump to its section. } - 0x13 + 0x12 \[\`TRANSACTIONFEE\`\](#isa-section-transactionfee) Get the computed transaction fee during teardown phase, zero otherwise { @@ -174,7 +166,7 @@ Click on an instruction name to jump to its section. } - 0x14 + 0x13 \[\`CHAINID\`\](#isa-section-chainid) Get this rollup's L1 chain ID { @@ -182,7 +174,7 @@ Click on an instruction name to jump to its section. } - 0x15 + 0x14 \[\`VERSION\`\](#isa-section-version) Get this rollup's L2 version ID { @@ -190,7 +182,7 @@ Click on an instruction name to jump to its section. } - 0x16 + 0x15 \[\`BLOCKNUMBER\`\](#isa-section-blocknumber) Get this L2 block's number { @@ -198,7 +190,7 @@ Click on an instruction name to jump to its section. } - 0x17 + 0x16 \[\`TIMESTAMP\`\](#isa-section-timestamp) Get this L2 block's timestamp { @@ -206,7 +198,7 @@ Click on an instruction name to jump to its section. } - 0x18 + 0x17 \[\`COINBASE\`\](#isa-section-coinbase) (UNIMPLEMENTED) Get the block's beneficiary address { @@ -214,7 +206,7 @@ Click on an instruction name to jump to its section. } - 0x19 + 0x18 \[\`FEEPERL2GAS\`\](#isa-section-feeperl2gas) Get the fee to be paid per "L2 gas" - constant for entire transaction { @@ -222,7 +214,7 @@ Click on an instruction name to jump to its section. } - 0x1a + 0x19 \[\`FEEPERDAGAS\`\](#isa-section-feeperdagas) Get the fee to be paid per "DA gas" - constant for entire transaction { @@ -230,7 +222,7 @@ Click on an instruction name to jump to its section. } - 0x1b + 0x1a \[\`BLOCKL2GASLIMIT\`\](#isa-section-blockl2gaslimit) (UNIMPLEMENTED) Total amount of "L2 gas" that a block can consume { @@ -238,7 +230,7 @@ Click on an instruction name to jump to its section. } - 0x1c + 0x1b \[\`BLOCKDAGASLIMIT\`\](#isa-section-blockdagaslimit) (UNIMPLEMENTED) Total amount of "DA gas" that a block can consume { @@ -246,7 +238,7 @@ Click on an instruction name to jump to its section. } - 0x1d + 0x1c \[\`CALLDATACOPY\`\](#isa-section-calldatacopy) Copy calldata into memory { @@ -254,7 +246,7 @@ Click on an instruction name to jump to its section. } - 0x1e + 0x1d \[\`L2GASLEFT\`\](#isa-section-l2gasleft) Remaining "L2 gas" for this call (after this instruction) { @@ -262,7 +254,7 @@ Click on an instruction name to jump to its section. } - 0x1f + 0x1e \[\`DAGASLEFT\`\](#isa-section-dagasleft) Remaining "DA gas" for this call (after this instruction) { @@ -270,7 +262,7 @@ Click on an instruction name to jump to its section. } - 0x20 + 0x1f \[\`JUMP\`\](#isa-section-jump) Jump to a location in the bytecode { @@ -278,7 +270,7 @@ Click on an instruction name to jump to its section. } - 0x21 + 0x20 \[\`JUMPI\`\](#isa-section-jumpi) Conditionally jump to a location in the bytecode { @@ -286,7 +278,7 @@ Click on an instruction name to jump to its section. } - 0x22 + 0x21 \[\`INTERNALCALL\`\](#isa-section-internalcall) Make an internal call. Push the current PC to the internal call stack and jump to the target location. @@ -295,7 +287,7 @@ context.machineState.pc = loc`} - 0x23 + 0x22 \[\`INTERNALRETURN\`\](#isa-section-internalreturn) Return from an internal call. Pop from the internal call stack and jump to the popped location. { @@ -303,7 +295,7 @@ context.machineState.pc = loc`} } - 0x24 + 0x23 \[\`SET\`\](#isa-section-set) Set a memory word from a constant in the bytecode { @@ -311,7 +303,7 @@ context.machineState.pc = loc`} } - 0x25 + 0x24 \[\`MOV\`\](#isa-section-mov) Move a word from source memory location to destination { @@ -319,7 +311,7 @@ context.machineState.pc = loc`} } - 0x26 + 0x25 \[\`CMOV\`\](#isa-section-cmov) Move a word (conditionally chosen) from one memory location to another (`d = cond > 0 ? a : b`) { @@ -327,7 +319,7 @@ context.machineState.pc = loc`} } - 0x27 + 0x26 \[\`SLOAD\`\](#isa-section-sload) Load a word from this contract's persistent public storage. Zero is loaded for unwritten slots. @@ -335,7 +327,7 @@ context.machineState.pc = loc`} - 0x28 + 0x27 \[\`SSTORE\`\](#isa-section-sstore) Write a word to this contract's persistent public storage @@ -343,29 +335,29 @@ context.machineState.pc = loc`} - 0x29 + 0x28 \[\`NOTEHASHEXISTS\`\](#isa-section-notehashexists) Check whether a note hash exists in the note hash tree (as of the start of the current block) {`exists = context.worldState.noteHashes.has({ leafIndex: M[leafIndexOffset] - leaf: hash(context.environment.storageAddress, M[noteHashOffset]), + leaf: hash(context.environment.address, M[noteHashOffset]), }) M[existsOffset] = exists`} - 0x2a + 0x29 \[\`EMITNOTEHASH\`\](#isa-section-emitnotehash) Emit a new note hash to be inserted into the note hash tree {`context.worldState.noteHashes.append( - hash(context.environment.storageAddress, M[noteHashOffset]) + hash(context.environment.address, M[noteHashOffset]) )`} - 0x2b + 0x2a \[\`NULLIFIEREXISTS\`\](#isa-section-nullifierexists) Check whether a nullifier exists in the nullifier tree (including nullifiers from earlier in the current transaction or from earlier in the current block) @@ -376,17 +368,17 @@ M[existsOffset] = exists`} - 0x2c + 0x2b \[\`EMITNULLIFIER\`\](#isa-section-emitnullifier) Emit a new nullifier to be inserted into the nullifier tree {`context.worldState.nullifiers.append( - hash(context.environment.storageAddress, M[nullifierOffset]) + hash(context.environment.address, M[nullifierOffset]) )`} - 0x2d + 0x2c \[\`L1TOL2MSGEXISTS\`\](#isa-section-l1tol2msgexists) Check if a message exists in the L1-to-L2 message tree @@ -397,7 +389,7 @@ M[existsOffset] = exists`} - 0x2e + 0x2d \[\`HEADERMEMBER\`\](#isa-section-headermember) (UNIMPLEMENTED) Check if a header exists in the [archive tree](../state/archive) and retrieve the specified member if so @@ -411,7 +403,7 @@ if exists: - 0x2f + 0x2e \[\`GETCONTRACTINSTANCE\`\](#isa-section-getcontractinstance) Copies contract instance data to memory @@ -427,7 +419,7 @@ if exists: - 0x30 + 0x2f \[\`EMITUNENCRYPTEDLOG\`\](#isa-section-emitunencryptedlog) Emit an unencrypted log @@ -440,7 +432,7 @@ if exists: - 0x31 + 0x30 \[\`SENDL2TOL1MSG\`\](#isa-section-sendl2tol1msg) Send an L2-to-L1 message @@ -454,7 +446,7 @@ if exists: - 0x32 + 0x31 \[\`CALL\`\](#isa-section-call) Call into another contract @@ -469,7 +461,7 @@ updateContextAfterNestedCall(context, instr.args, nestedContext)`} - 0x33 + 0x32 \[\`STATICCALL\`\](#isa-section-staticcall) Call into another contract, disallowing World State and Accrued Substate modifications @@ -484,7 +476,7 @@ updateContextAfterNestedCall(context, instr.args, nestedContext)`} - 0x34 + 0x33 \[\`RETURN\`\](#isa-section-return) Halt execution within this context (without revert), optionally returning some data @@ -493,7 +485,7 @@ halt`} - 0x35 + 0x34 \[\`REVERT\`\](#isa-section-revert) Halt execution within this context as `reverted`, optionally returning some data @@ -503,7 +495,7 @@ halt`} - 0x36 + 0x35 \[\`TORADIXLE\`\](#isa-section-to_radix_le) Convert a word to an array of limbs in little-endian radix form TBD: Storage of limbs and if T[dstOffset] is constrained to U8 @@ -845,30 +837,12 @@ Get the address of the currently executing l2 contract [![](/img/protocol-specs/public-vm/bit-formats/ADDRESS.png)](/img/protocol-specs/public-vm/bit-formats/ADDRESS.png) -### `STORAGEADDRESS` -Get the _storage_ address of the currently executing context - -[See in table.](#isa-table-storageaddress) - -- **Opcode**: 0x10 -- **Category**: Execution Environment -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **dstOffset**: memory offset specifying where to store operation's result -- **Expression**: `M[dstOffset] = context.environment.storageAddress` -- **Details**: The storage address is used for public storage accesses. -- **Tag updates**: `T[dstOffset] = field` -- **Bit-size**: 56 - -[![](/img/protocol-specs/public-vm/bit-formats/STORAGEADDRESS.png)](/img/protocol-specs/public-vm/bit-formats/STORAGEADDRESS.png) - ### `SENDER` Get the address of the sender (caller of the current context) [See in table.](#isa-table-sender) -- **Opcode**: 0x11 +- **Opcode**: 0x10 - **Category**: Execution Environment - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -885,7 +859,7 @@ Get the function selector of the contract function being executed [See in table.](#isa-table-functionselector) -- **Opcode**: 0x12 +- **Opcode**: 0x11 - **Category**: Execution Environment - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -901,7 +875,7 @@ Get the computed transaction fee during teardown phase, zero otherwise [See in table.](#isa-table-transactionfee) -- **Opcode**: 0x13 +- **Opcode**: 0x12 - **Category**: Execution Environment - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -917,7 +891,7 @@ Get this rollup's L1 chain ID [See in table.](#isa-table-chainid) -- **Opcode**: 0x14 +- **Opcode**: 0x13 - **Category**: Execution Environment - Globals - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -934,7 +908,7 @@ Get this rollup's L2 version ID [See in table.](#isa-table-version) -- **Opcode**: 0x15 +- **Opcode**: 0x14 - **Category**: Execution Environment - Globals - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -951,7 +925,7 @@ Get this L2 block's number [See in table.](#isa-table-blocknumber) -- **Opcode**: 0x16 +- **Opcode**: 0x15 - **Category**: Execution Environment - Globals - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -968,7 +942,7 @@ Get this L2 block's timestamp [See in table.](#isa-table-timestamp) -- **Opcode**: 0x17 +- **Opcode**: 0x16 - **Category**: Execution Environment - Globals - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -985,7 +959,7 @@ Get this L2 block's timestamp [See in table.](#isa-table-coinbase) -- **Opcode**: 0x18 +- **Opcode**: 0x17 - **Category**: Execution Environment - Globals - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1002,7 +976,7 @@ Get the fee to be paid per "L2 gas" - constant for entire transaction [See in table.](#isa-table-feeperl2gas) -- **Opcode**: 0x19 +- **Opcode**: 0x18 - **Category**: Execution Environment - Globals - Gas - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1019,7 +993,7 @@ Get the fee to be paid per "DA gas" - constant for entire transaction [See in table.](#isa-table-feeperdagas) -- **Opcode**: 0x1a +- **Opcode**: 0x19 - **Category**: Execution Environment - Globals - Gas - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1036,7 +1010,7 @@ Get the fee to be paid per "DA gas" - constant for entire transaction [See in table.](#isa-table-blockl2gaslimit) -- **Opcode**: 0x1b +- **Opcode**: 0x1a - **Category**: Execution Environment - Globals - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1053,7 +1027,7 @@ Get the fee to be paid per "DA gas" - constant for entire transaction [See in table.](#isa-table-blockdagaslimit) -- **Opcode**: 0x1c +- **Opcode**: 0x1b - **Category**: Execution Environment - Globals - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1070,7 +1044,7 @@ Copy calldata into memory [See in table.](#isa-table-calldatacopy) -- **Opcode**: 0x1d +- **Opcode**: 0x1c - **Category**: Execution Environment - Calldata - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1090,7 +1064,7 @@ Remaining "L2 gas" for this call (after this instruction) [See in table.](#isa-table-l2gasleft) -- **Opcode**: 0x1e +- **Opcode**: 0x1d - **Category**: Machine State - Gas - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1107,7 +1081,7 @@ Remaining "DA gas" for this call (after this instruction) [See in table.](#isa-table-dagasleft) -- **Opcode**: 0x1f +- **Opcode**: 0x1e - **Category**: Machine State - Gas - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1124,7 +1098,7 @@ Jump to a location in the bytecode [See in table.](#isa-table-jump) -- **Opcode**: 0x20 +- **Opcode**: 0x1f - **Category**: Machine State - Control Flow - **Args**: - **loc**: target location to jump to @@ -1139,7 +1113,7 @@ Conditionally jump to a location in the bytecode [See in table.](#isa-table-jumpi) -- **Opcode**: 0x21 +- **Opcode**: 0x20 - **Category**: Machine State - Control Flow - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1157,7 +1131,7 @@ Make an internal call. Push the current PC to the internal call stack and jump t [See in table.](#isa-table-internalcall) -- **Opcode**: 0x22 +- **Opcode**: 0x21 - **Category**: Machine State - Control Flow - **Args**: - **loc**: target location to jump/call to @@ -1175,7 +1149,7 @@ Return from an internal call. Pop from the internal call stack and jump to the p [See in table.](#isa-table-internalreturn) -- **Opcode**: 0x23 +- **Opcode**: 0x22 - **Category**: Machine State - Control Flow - **Expression**: `context.machineState.pc = context.machineState.internalCallStack.pop()` - **Bit-size**: 16 @@ -1187,7 +1161,7 @@ Set a memory word from a constant in the bytecode [See in table.](#isa-table-set) -- **Opcode**: 0x24 +- **Opcode**: 0x23 - **Category**: Machine State - Memory - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1207,7 +1181,7 @@ Move a word from source memory location to destination [See in table.](#isa-table-mov) -- **Opcode**: 0x25 +- **Opcode**: 0x24 - **Category**: Machine State - Memory - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1225,7 +1199,7 @@ Move a word (conditionally chosen) from one memory location to another (`d \= co [See in table.](#isa-table-cmov) -- **Opcode**: 0x26 +- **Opcode**: 0x25 - **Category**: Machine State - Memory - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1246,7 +1220,7 @@ Load a word from this contract's persistent public storage. Zero is loaded for u [See in table.](#isa-table-sload) -- **Opcode**: 0x27 +- **Opcode**: 0x26 - **Category**: World State - Public Storage - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1260,7 +1234,7 @@ Load a word from this contract's persistent public storage. Zero is loaded for u - **Details**: {`// Expression is shorthand for -leafIndex = hash(context.environment.storageAddress, M[slotOffset]) +leafIndex = hash(context.environment.address, M[slotOffset]) exists = context.worldState.publicStorage.has(leafIndex) // exists == previously-written if exists: value = context.worldState.publicStorage.get(leafIndex: leafIndex) @@ -1291,7 +1265,7 @@ Write a word to this contract's persistent public storage [See in table.](#isa-table-sstore) -- **Opcode**: 0x28 +- **Opcode**: 0x27 - **Category**: World State - Public Storage - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1306,7 +1280,7 @@ Write a word to this contract's persistent public storage {`// Expression is shorthand for context.worldState.publicStorage.set({ - leafIndex: hash(context.environment.storageAddress, M[slotOffset]), + leafIndex: hash(context.environment.address, M[slotOffset]), leaf: M[srcOffset], })`} @@ -1331,7 +1305,7 @@ Check whether a note hash exists in the note hash tree (as of the start of the c [See in table.](#isa-table-notehashexists) -- **Opcode**: 0x29 +- **Opcode**: 0x28 - **Category**: World State - Notes & Nullifiers - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1343,7 +1317,7 @@ Check whether a note hash exists in the note hash tree (as of the start of the c {`exists = context.worldState.noteHashes.has({ leafIndex: M[leafIndexOffset] - leaf: hash(context.environment.storageAddress, M[noteHashOffset]), + leaf: hash(context.environment.address, M[noteHashOffset]), }) M[existsOffset] = exists`} @@ -1369,7 +1343,7 @@ Emit a new note hash to be inserted into the note hash tree [See in table.](#isa-table-emitnotehash) -- **Opcode**: 0x2a +- **Opcode**: 0x29 - **Category**: World State - Notes & Nullifiers - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1378,7 +1352,7 @@ Emit a new note hash to be inserted into the note hash tree - **Expression**: {`context.worldState.noteHashes.append( - hash(context.environment.storageAddress, M[noteHashOffset]) + hash(context.environment.address, M[noteHashOffset]) )`} - **World State access tracing**: @@ -1401,13 +1375,13 @@ Check whether a nullifier exists in the nullifier tree (including nullifiers fro [See in table.](#isa-table-nullifierexists) -- **Opcode**: 0x2b +- **Opcode**: 0x2a - **Category**: World State - Notes & Nullifiers - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - **Args**: - **nullifierOffset**: memory offset of the unsiloed nullifier - - **addressOffset**: memory offset of the storage address + - **addressOffset**: memory offset of the address - **existsOffset**: memory offset specifying where to store operation's result (whether the nullifier exists) - **Expression**: @@ -1422,7 +1396,7 @@ M[existsOffset] = exists`} TracedNullifierCheck { callPointer: context.environment.callPointer, nullifier: M[nullifierOffset], - storageAddress: M[addressOffset], + address: M[addressOffset], exists: exists, // defined above counter: ++context.worldStateAccessTrace.accessCounter, } @@ -1438,7 +1412,7 @@ Emit a new nullifier to be inserted into the nullifier tree [See in table.](#isa-table-emitnullifier) -- **Opcode**: 0x2c +- **Opcode**: 0x2b - **Category**: World State - Notes & Nullifiers - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1447,7 +1421,7 @@ Emit a new nullifier to be inserted into the nullifier tree - **Expression**: {`context.worldState.nullifiers.append( - hash(context.environment.storageAddress, M[nullifierOffset]) + hash(context.environment.address, M[nullifierOffset]) )`} - **World State access tracing**: @@ -1470,7 +1444,7 @@ Check if a message exists in the L1-to-L2 message tree [See in table.](#isa-table-l1tol2msgexists) -- **Opcode**: 0x2d +- **Opcode**: 0x2c - **Category**: World State - Messaging - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1509,7 +1483,7 @@ M[existsOffset] = exists`} [See in table.](#isa-table-headermember) -- **Opcode**: 0x2e +- **Opcode**: 0x2d - **Category**: World State - Archive Tree & Headers - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1552,7 +1526,7 @@ Copies contract instance data to memory [See in table.](#isa-table-getcontractinstance) -- **Opcode**: 0x2f +- **Opcode**: 0x2e - **Category**: Other - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1582,7 +1556,7 @@ Emit an unencrypted log [See in table.](#isa-table-emitunencryptedlog) -- **Opcode**: 0x30 +- **Opcode**: 0x2f - **Category**: Accrued Substate - Logging - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1607,7 +1581,7 @@ Send an L2-to-L1 message [See in table.](#isa-table-sendl2tol1msg) -- **Opcode**: 0x31 +- **Opcode**: 0x30 - **Category**: Accrued Substate - Messaging - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1633,7 +1607,7 @@ Call into another contract [See in table.](#isa-table-call) -- **Opcode**: 0x32 +- **Opcode**: 0x31 - **Category**: Control Flow - Contract Calls - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1680,7 +1654,7 @@ Call into another contract, disallowing World State and Accrued Substate modific [See in table.](#isa-table-staticcall) -- **Opcode**: 0x33 +- **Opcode**: 0x32 - **Category**: Control Flow - Contract Calls - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1724,7 +1698,7 @@ Halt execution within this context (without revert), optionally returning some d [See in table.](#isa-table-return) -- **Opcode**: 0x34 +- **Opcode**: 0x33 - **Category**: Control Flow - Contract Calls - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1746,7 +1720,7 @@ Halt execution within this context as `reverted`, optionally returning some data [See in table.](#isa-table-revert) -- **Opcode**: 0x35 +- **Opcode**: 0x34 - **Category**: Control Flow - Contract Calls - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. @@ -1769,7 +1743,7 @@ Convert a word to an array of limbs in little-endian radix form [See in table.](#isa-table-to_radix_le) -- **Opcode**: 0x36 +- **Opcode**: 0x35 - **Category**: Conversions - **Flags**: - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. diff --git a/docs/docs/protocol-specs/public-vm/instruction-set.mdx b/docs/docs/protocol-specs/public-vm/instruction-set.mdx index 13047ff724d..b6ee8e5d8ba 100644 --- a/docs/docs/protocol-specs/public-vm/instruction-set.mdx +++ b/docs/docs/protocol-specs/public-vm/instruction-set.mdx @@ -7,7 +7,7 @@ This page lists all of the instructions supported by the Aztec Virtual Machine ( The following notes are relevant to the table and sections below: - `M[offset]` notation is shorthand for `context.machineState.memory[offset]` -- `S[slot]` notation is shorthand for an access to the specified slot in the current contract's public storage (`context.worldState.publicStorage`) after the slot has been siloed by the storage address (`hash(context.environment.storageAddress, slot)`) +- `S[slot]` notation is shorthand for an access to the specified slot in the current contract's public storage (`context.worldState.publicStorage`) after the slot has been siloed by the contract address (`hash(context.environment.address, slot)`) - Any instruction whose description does not mention a program counter change simply increments it: `context.machineState.pc++` - All instructions update `context.machineState.*GasLeft` as detailed in ["Gas limits and tracking"](./execution#gas-checks-and-tracking) - Any instruction can lead to an exceptional halt as specified in ["Exceptional halting"](./execution#exceptional-halting) diff --git a/docs/docs/protocol-specs/public-vm/nested-calls.mdx b/docs/docs/protocol-specs/public-vm/nested-calls.mdx index 7105e28f462..1f6234c5844 100644 --- a/docs/docs/protocol-specs/public-vm/nested-calls.mdx +++ b/docs/docs/protocol-specs/public-vm/nested-calls.mdx @@ -43,7 +43,6 @@ context.worldStateAccessTrace.contractCalls.append( TracedContractCall { callPointer: context.worldStateAccessTrace.contractCalls.length + 1, address: M[addrOffset], - storageAddress: M[addrOffset], counter: ++context.worldStateAccessTrace.accessCounter, endLifetime: 0, // The call's end-lifetime will be updated later if it or its caller reverts } diff --git a/docs/docs/protocol-specs/public-vm/type-structs.md b/docs/docs/protocol-specs/public-vm/type-structs.md index a02360fb77c..15adf635e68 100644 --- a/docs/docs/protocol-specs/public-vm/type-structs.md +++ b/docs/docs/protocol-specs/public-vm/type-structs.md @@ -8,7 +8,6 @@ This section lists type definitions relevant to AVM State and Circuit I/O. | --- | --- | --- | | `callPointer` | `field` | The call pointer assigned to this call. | | `address` | `field` | The called contract address. | -| `storageAddress` | `field` | The storage contract address (different from `address` for delegate calls). | | `counter` | `field` | When did this occur relative to other world state accesses. | | `endLifetime` | `field` | End lifetime of a call. Final `accessCounter` for reverted calls, `endLifetime` of parent for successful calls. Successful initial/top-level calls have infinite (max-value) `endLifetime`. | diff --git a/docs/src/preprocess/InstructionSet/InstructionSet.js b/docs/src/preprocess/InstructionSet/InstructionSet.js index 5500db803c4..ce636e68783 100644 --- a/docs/src/preprocess/InstructionSet/InstructionSet.js +++ b/docs/src/preprocess/InstructionSet/InstructionSet.js @@ -513,24 +513,6 @@ const INSTRUCTION_SET_RAW = [ "Tag checks": "", "Tag updates": "`T[dstOffset] = field`", }, - { - id: "storageaddress", - Name: "`STORAGEADDRESS`", - Category: "Execution Environment", - Flags: [{ name: "indirect", description: INDIRECT_FLAG_DESCRIPTION }], - Args: [ - { - name: "dstOffset", - description: - "memory offset specifying where to store operation's result", - }, - ], - Expression: "`M[dstOffset] = context.environment.storageAddress`", - Summary: "Get the _storage_ address of the currently executing context", - Details: "The storage address is used for public storage accesses.", - "Tag checks": "", - "Tag updates": "`T[dstOffset] = field`", - }, { id: "sender", Name: "`SENDER`", @@ -1000,7 +982,7 @@ M[dstOffset] = S[M[slotOffset]] "Load a word from this contract's persistent public storage. Zero is loaded for unwritten slots.", Details: ` // Expression is shorthand for -leafIndex = hash(context.environment.storageAddress, M[slotOffset]) +leafIndex = hash(context.environment.address, M[slotOffset]) exists = context.worldState.publicStorage.has(leafIndex) // exists == previously-written if exists: value = context.worldState.publicStorage.get(leafIndex: leafIndex) @@ -1043,7 +1025,7 @@ S[M[slotOffset]] = M[srcOffset] Details: ` // Expression is shorthand for context.worldState.publicStorage.set({ - leafIndex: hash(context.environment.storageAddress, M[slotOffset]), + leafIndex: hash(context.environment.address, M[slotOffset]), leaf: M[srcOffset], }) `, @@ -1082,7 +1064,7 @@ context.worldStateAccessTrace.publicStorageWrites.append( Expression: ` exists = context.worldState.noteHashes.has({ leafIndex: M[leafIndexOffset] - leaf: hash(context.environment.storageAddress, M[noteHashOffset]), + leaf: hash(context.environment.address, M[noteHashOffset]), }) M[existsOffset] = exists `, @@ -1114,7 +1096,7 @@ context.worldStateAccessTrace.noteHashChecks.append( ], Expression: ` context.worldState.noteHashes.append( - hash(context.environment.storageAddress, M[noteHashOffset]) + hash(context.environment.address, M[noteHashOffset]) ) `, Summary: "Emit a new note hash to be inserted into the note hash tree", @@ -1144,7 +1126,7 @@ context.worldStateAccessTrace.noteHashes.append( }, { name: "addressOffset", - description: "memory offset of the storage address", + description: "memory offset of the address", }, { name: "existsOffset", @@ -1165,7 +1147,7 @@ context.worldStateAccessTrace.nullifierChecks.append( TracedNullifierCheck { callPointer: context.environment.callPointer, nullifier: M[nullifierOffset], - storageAddress: M[addressOffset], + address: M[addressOffset], exists: exists, // defined above counter: ++context.worldStateAccessTrace.accessCounter, } @@ -1186,7 +1168,7 @@ context.worldStateAccessTrace.nullifierChecks.append( ], Expression: ` context.worldState.nullifiers.append( - hash(context.environment.storageAddress, M[nullifierOffset]) + hash(context.environment.address, M[nullifierOffset]) ) `, Summary: "Emit a new nullifier to be inserted into the nullifier tree", diff --git a/l1-contracts/src/core/libraries/ConstantsGen.sol b/l1-contracts/src/core/libraries/ConstantsGen.sol index d954c8b778f..ae4f37373e8 100644 --- a/l1-contracts/src/core/libraries/ConstantsGen.sol +++ b/l1-contracts/src/core/libraries/ConstantsGen.sol @@ -221,7 +221,6 @@ library Constants { uint256 internal constant VERIFICATION_KEY_LENGTH_IN_FIELDS = 128; uint256 internal constant SENDER_SELECTOR = 0; uint256 internal constant ADDRESS_SELECTOR = 1; - uint256 internal constant STORAGE_ADDRESS_SELECTOR = 1; uint256 internal constant FUNCTION_SELECTOR_SELECTOR = 2; uint256 internal constant START_GLOBAL_VARIABLES = 29; uint256 internal constant CHAIN_ID_SELECTOR = 29; diff --git a/noir-projects/aztec-nr/aztec/src/context/public_context.nr b/noir-projects/aztec-nr/aztec/src/context/public_context.nr index d77352c95d9..3309a700e2e 100644 --- a/noir-projects/aztec-nr/aztec/src/context/public_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/public_context.nr @@ -111,9 +111,6 @@ impl PublicContext { fn this_address(_self: Self) -> AztecAddress { address() } - pub fn storage_address(_self: Self) -> AztecAddress { - storage_address() - } fn msg_sender(_self: Self) -> AztecAddress { sender() } @@ -191,9 +188,6 @@ fn gas_for_call(user_gas: GasOpts) -> [Field; 2] { unconstrained fn address() -> AztecAddress { address_opcode() } -unconstrained fn storage_address() -> AztecAddress { - storage_address_opcode() -} unconstrained fn sender() -> AztecAddress { sender_opcode() } @@ -286,9 +280,6 @@ impl Empty for PublicContext { #[oracle(avmOpcodeAddress)] unconstrained fn address_opcode() -> AztecAddress {} -#[oracle(avmOpcodeStorageAddress)] -unconstrained fn storage_address_opcode() -> AztecAddress {} - #[oracle(avmOpcodeSender)] unconstrained fn sender_opcode() -> AztecAddress {} diff --git a/noir-projects/noir-contracts/contracts/avm_test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/avm_test_contract/src/main.nr index 81ef861d364..4280e2a54ae 100644 --- a/noir-projects/noir-contracts/contracts/avm_test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/avm_test_contract/src/main.nr @@ -272,11 +272,6 @@ contract AvmTest { context.this_address() } - #[aztec(public)] - fn get_storage_address() -> AztecAddress { - context.storage_address() - } - #[aztec(public)] fn get_sender() -> AztecAddress { context.msg_sender() @@ -380,19 +375,19 @@ contract AvmTest { // Use the standard context interface to check for a nullifier #[aztec(public)] fn nullifier_exists(nullifier: Field) -> bool { - context.nullifier_exists(nullifier, context.storage_address()) + context.nullifier_exists(nullifier, context.this_address()) } #[aztec(public)] fn assert_nullifier_exists(nullifier: Field) { - assert(context.nullifier_exists(nullifier, context.storage_address()), "Nullifier doesn't exist!"); + assert(context.nullifier_exists(nullifier, context.this_address()), "Nullifier doesn't exist!"); } // Use the standard context interface to emit a new nullifier #[aztec(public)] fn emit_nullifier_and_check(nullifier: Field) { context.push_nullifier(nullifier); - let exists = context.nullifier_exists(nullifier, context.storage_address()); + let exists = context.nullifier_exists(nullifier, context.this_address()); assert(exists, "Nullifier was just created, but its existence wasn't detected!"); } diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr index 7ad21602e4e..d12b7f36a92 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -366,10 +366,7 @@ global GENERATOR_INDEX__NOTE_HIDING_POINT: u32 = 54; global GENERATOR_INDEX__SYMMETRIC_KEY: u8 = 55; global SENDER_SELECTOR: u32 = 0; -// "address" actually does not exist in PublicCircuitPublicInputs, -// so this is just an alias to "storage address" for now global ADDRESS_SELECTOR: u32 = SENDER_SELECTOR + 1; -global STORAGE_ADDRESS_SELECTOR: u32 = ADDRESS_SELECTOR; global FUNCTION_SELECTOR_SELECTOR: u32 = ADDRESS_SELECTOR + 1; // Global Variables global START_GLOBAL_VARIABLES: u32 = CALL_CONTEXT_LENGTH + HEADER_LENGTH; @@ -422,7 +419,6 @@ global AVM_SHL_BASE_L2_GAS: u16 = 320; global AVM_SHR_BASE_L2_GAS: u16 = 320; global AVM_CAST_BASE_L2_GAS: u16 = 300; global AVM_ADDRESS_BASE_L2_GAS: u16 = 200; -global AVM_STORAGEADDRESS_BASE_L2_GAS: u16 = 200; global AVM_SENDER_BASE_L2_GAS: u16 = 200; global AVM_FUNCTIONSELECTOR_BASE_L2_GAS: u16 = 200; global AVM_TRANSACTIONFEE_BASE_L2_GAS: u16 = 200; @@ -488,7 +484,6 @@ global AVM_SHL_DYN_L2_GAS: u16 = 0; global AVM_SHR_DYN_L2_GAS: u16 = 0; global AVM_CAST_DYN_L2_GAS: u16 = 0; global AVM_ADDRESS_DYN_L2_GAS: u16 = 0; -global AVM_STORAGEADDRESS_DYN_L2_GAS: u16 = 0; global AVM_SENDER_DYN_L2_GAS: u16 = 0; global AVM_FUNCTIONSELECTOR_DYN_L2_GAS: u16 = 0; global AVM_TRANSACTIONFEE_DYN_L2_GAS: u16 = 0; diff --git a/yarn-project/bb-prover/src/avm_proving.test.ts b/yarn-project/bb-prover/src/avm_proving.test.ts index d48c1eb4859..19d20502337 100644 --- a/yarn-project/bb-prover/src/avm_proving.test.ts +++ b/yarn-project/bb-prover/src/avm_proving.test.ts @@ -171,7 +171,6 @@ describe('AVM WitGen, proof generation and verification', () => { describe('AVM Context functions', () => { const avmContextFunctions = [ 'get_address', - 'get_storage_address', 'get_sender', 'get_fee_per_l2_gas', 'get_fee_per_da_gas', diff --git a/yarn-project/circuits.js/src/constants.gen.ts b/yarn-project/circuits.js/src/constants.gen.ts index 63b4925c9a8..5ab54bbbaee 100644 --- a/yarn-project/circuits.js/src/constants.gen.ts +++ b/yarn-project/circuits.js/src/constants.gen.ts @@ -205,7 +205,6 @@ export const VERIFICATION_KEY_LENGTH_IN_FIELDS = 128; export const AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS = 66; export const SENDER_SELECTOR = 0; export const ADDRESS_SELECTOR = 1; -export const STORAGE_ADDRESS_SELECTOR = 1; export const FUNCTION_SELECTOR_SELECTOR = 2; export const START_GLOBAL_VARIABLES = 29; export const CHAIN_ID_SELECTOR = 29; @@ -248,7 +247,6 @@ export const AVM_SHL_BASE_L2_GAS = 320; export const AVM_SHR_BASE_L2_GAS = 320; export const AVM_CAST_BASE_L2_GAS = 300; export const AVM_ADDRESS_BASE_L2_GAS = 200; -export const AVM_STORAGEADDRESS_BASE_L2_GAS = 200; export const AVM_SENDER_BASE_L2_GAS = 200; export const AVM_FUNCTIONSELECTOR_BASE_L2_GAS = 200; export const AVM_TRANSACTIONFEE_BASE_L2_GAS = 200; @@ -313,7 +311,6 @@ export const AVM_SHL_DYN_L2_GAS = 0; export const AVM_SHR_DYN_L2_GAS = 0; export const AVM_CAST_DYN_L2_GAS = 0; export const AVM_ADDRESS_DYN_L2_GAS = 0; -export const AVM_STORAGEADDRESS_DYN_L2_GAS = 0; export const AVM_SENDER_DYN_L2_GAS = 0; export const AVM_FUNCTIONSELECTOR_DYN_L2_GAS = 0; export const AVM_TRANSACTIONFEE_DYN_L2_GAS = 0; diff --git a/yarn-project/circuits.js/src/scripts/constants.in.ts b/yarn-project/circuits.js/src/scripts/constants.in.ts index d2e7f347643..444a0b692d7 100644 --- a/yarn-project/circuits.js/src/scripts/constants.in.ts +++ b/yarn-project/circuits.js/src/scripts/constants.in.ts @@ -57,7 +57,6 @@ const CPP_CONSTANTS = [ 'START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET', 'SENDER_SELECTOR', 'ADDRESS_SELECTOR', - 'STORAGE_ADDRESS_SELECTOR', 'FUNCTION_SELECTOR_SELECTOR', 'START_GLOBAL_VARIABLES', 'CHAIN_ID_SELECTOR', @@ -96,7 +95,6 @@ const PIL_CONSTANTS = [ 'START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET', 'SENDER_SELECTOR', 'ADDRESS_SELECTOR', - 'STORAGE_ADDRESS_SELECTOR', 'FUNCTION_SELECTOR_SELECTOR', 'START_GLOBAL_VARIABLES', 'CHAIN_ID_SELECTOR', diff --git a/yarn-project/end-to-end/src/e2e_avm_simulator.test.ts b/yarn-project/end-to-end/src/e2e_avm_simulator.test.ts index c73834ad68f..e5545e57451 100644 --- a/yarn-project/end-to-end/src/e2e_avm_simulator.test.ts +++ b/yarn-project/end-to-end/src/e2e_avm_simulator.test.ts @@ -38,7 +38,7 @@ describe('e2e_avm_simulator', () => { }); it('PXE processes failed assertions and fills in the error message with the expression (even complex ones)', async () => { await expect(avmContract.methods.assert_nullifier_exists(123).simulate()).rejects.toThrow( - "Assertion failed: Nullifier doesn't exist! 'context.nullifier_exists(nullifier, context.storage_address())'", + "Assertion failed: Nullifier doesn't exist! 'context.nullifier_exists(nullifier, context.this_address())'", ); }); }); diff --git a/yarn-project/simulator/src/avm/avm_context.test.ts b/yarn-project/simulator/src/avm/avm_context.test.ts index a96d8898306..2d083e33430 100644 --- a/yarn-project/simulator/src/avm/avm_context.test.ts +++ b/yarn-project/simulator/src/avm/avm_context.test.ts @@ -15,7 +15,6 @@ describe('Avm Context', () => { expect(newContext.environment).toEqual( allSameExcept(context.environment, { address: newAddress, - storageAddress: newAddress, contractCallDepth: Fr.ONE, // Calldata also includes AvmContextInputs calldata: anyAvmContextInputs().concat(newCalldata), @@ -46,7 +45,6 @@ describe('Avm Context', () => { expect(newContext.environment).toEqual( allSameExcept(context.environment, { address: newAddress, - storageAddress: newAddress, contractCallDepth: Fr.ONE, // Calldata also includes AvmContextInputs calldata: anyAvmContextInputs().concat(newCalldata), diff --git a/yarn-project/simulator/src/avm/avm_context.ts b/yarn-project/simulator/src/avm/avm_context.ts index b0ca8d3b2df..17f2cf544d4 100644 --- a/yarn-project/simulator/src/avm/avm_context.ts +++ b/yarn-project/simulator/src/avm/avm_context.ts @@ -30,7 +30,7 @@ export class AvmContext { * - Derive a machine state from the current state * - E.g., gas metering is preserved but pc is reset * - Derive an execution environment from the caller/parent - * - Alter both address and storageAddress + * - Alter both sender and address * * @param address - The contract instance to initialize a context for * @param calldata - Data/arguments for nested call diff --git a/yarn-project/simulator/src/avm/avm_execution_environment.test.ts b/yarn-project/simulator/src/avm/avm_execution_environment.test.ts index 2aa4a35d2ac..009161a0281 100644 --- a/yarn-project/simulator/src/avm/avm_execution_environment.test.ts +++ b/yarn-project/simulator/src/avm/avm_execution_environment.test.ts @@ -15,7 +15,6 @@ describe('Execution Environment', () => { expect(newExecutionEnvironment).toEqual( allSameExcept(executionEnvironment, { address: newAddress, - storageAddress: newAddress, contractCallDepth: Fr.ONE, // Calldata also includes AvmContextInputs calldata: anyAvmContextInputs().concat(calldata), @@ -34,7 +33,6 @@ describe('Execution Environment', () => { expect(newExecutionEnvironment).toEqual( allSameExcept(executionEnvironment, { address: newAddress, - storageAddress: newAddress, contractCallDepth: Fr.ONE, isStaticCall: true, // Calldata also includes AvmContextInputs diff --git a/yarn-project/simulator/src/avm/avm_execution_environment.ts b/yarn-project/simulator/src/avm/avm_execution_environment.ts index 156c3b5120e..f12e74299ce 100644 --- a/yarn-project/simulator/src/avm/avm_execution_environment.ts +++ b/yarn-project/simulator/src/avm/avm_execution_environment.ts @@ -20,7 +20,6 @@ export class AvmContextInputs { export class AvmExecutionEnvironment { constructor( public readonly address: AztecAddress, - public readonly storageAddress: AztecAddress, public readonly sender: AztecAddress, public readonly functionSelector: FunctionSelector, // may be temporary (#7224) public readonly contractCallDepth: Fr, @@ -44,7 +43,6 @@ export class AvmExecutionEnvironment { ) { return new AvmExecutionEnvironment( /*address=*/ targetAddress, - /*storageAddress=*/ targetAddress, /*sender=*/ this.address, functionSelector, this.contractCallDepth.add(Fr.ONE), diff --git a/yarn-project/simulator/src/avm/avm_gas.ts b/yarn-project/simulator/src/avm/avm_gas.ts index 82390020d7f..2b60a5ee076 100644 --- a/yarn-project/simulator/src/avm/avm_gas.ts +++ b/yarn-project/simulator/src/avm/avm_gas.ts @@ -73,7 +73,6 @@ const BaseGasCosts: Record = { [Opcode.SHR]: makeCost(c.AVM_SHR_BASE_L2_GAS, 0), [Opcode.CAST]: makeCost(c.AVM_CAST_BASE_L2_GAS, 0), [Opcode.ADDRESS]: makeCost(c.AVM_ADDRESS_BASE_L2_GAS, 0), - [Opcode.STORAGEADDRESS]: makeCost(c.AVM_STORAGEADDRESS_BASE_L2_GAS, 0), [Opcode.SENDER]: makeCost(c.AVM_SENDER_BASE_L2_GAS, 0), [Opcode.FEEPERL2GAS]: makeCost(c.AVM_FEEPERL2GAS_BASE_L2_GAS, 0), [Opcode.FEEPERDAGAS]: makeCost(c.AVM_FEEPERDAGAS_BASE_L2_GAS, 0), @@ -141,7 +140,6 @@ const DynamicGasCosts: Record = { [Opcode.SHR]: makeCost(c.AVM_SHR_DYN_L2_GAS, 0), [Opcode.CAST]: makeCost(c.AVM_CAST_DYN_L2_GAS, 0), [Opcode.ADDRESS]: makeCost(c.AVM_ADDRESS_DYN_L2_GAS, 0), - [Opcode.STORAGEADDRESS]: makeCost(c.AVM_STORAGEADDRESS_DYN_L2_GAS, 0), [Opcode.SENDER]: makeCost(c.AVM_SENDER_DYN_L2_GAS, 0), [Opcode.FEEPERL2GAS]: makeCost(c.AVM_FEEPERL2GAS_DYN_L2_GAS, 0), [Opcode.FEEPERDAGAS]: makeCost(c.AVM_FEEPERDAGAS_DYN_L2_GAS, 0), diff --git a/yarn-project/simulator/src/avm/avm_simulator.test.ts b/yarn-project/simulator/src/avm/avm_simulator.test.ts index 3eb40e1b731..e72cb52e0f0 100644 --- a/yarn-project/simulator/src/avm/avm_simulator.test.ts +++ b/yarn-project/simulator/src/avm/avm_simulator.test.ts @@ -259,7 +259,6 @@ describe('AVM simulator: transpiled Noir contracts', () => { describe('Environment getters', () => { const address = AztecAddress.random(); - const storageAddress = AztecAddress.random(); const sender = AztecAddress.random(); const functionSelector = FunctionSelector.random(); const transactionFee = Fr.random(); @@ -279,7 +278,6 @@ describe('AVM simulator: transpiled Noir contracts', () => { }); const env = initExecutionEnvironment({ address, - storageAddress, sender, functionSelector, transactionFee, @@ -292,7 +290,6 @@ describe('AVM simulator: transpiled Noir contracts', () => { it.each([ ['address', address.toField(), 'get_address'], - ['storageAddress', storageAddress.toField(), 'get_storage_address'], ['sender', sender.toField(), 'get_sender'], ['functionSelector', functionSelector.toField(), 'get_function_selector'], ['transactionFee', transactionFee.toField(), 'get_transaction_fee'], @@ -354,7 +351,6 @@ describe('AVM simulator: transpiled Noir contracts', () => { describe('Side effects, world state, nested calls', () => { const address = new Fr(1); - const storageAddress = new Fr(2); const sender = new Fr(42); const leafIndex = new Fr(7); const slotNumber = 1; // must update Noir contract if changing this @@ -379,7 +375,7 @@ describe('AVM simulator: transpiled Noir contracts', () => { const createContext = (calldata: Fr[] = []) => { return initContext({ persistableState, - env: initExecutionEnvironment({ address, storageAddress, sender, calldata }), + env: initExecutionEnvironment({ address, sender, calldata }), }); }; @@ -409,7 +405,7 @@ describe('AVM simulator: transpiled Noir contracts', () => { expect(trace.traceNoteHashCheck).toHaveBeenCalledTimes(1); expect(trace.traceNoteHashCheck).toHaveBeenCalledWith( - storageAddress, + address, /*noteHash=*/ value0, leafIndex, /*exists=*/ expectFound, @@ -437,7 +433,7 @@ describe('AVM simulator: transpiled Noir contracts', () => { // leafIndex is returned from DB call for nullifiers, so it is absent on DB miss const tracedLeafIndex = exists && !isPending ? leafIndex : Fr.ZERO; expect(trace.traceNullifierCheck).toHaveBeenCalledWith( - storageAddress, + address, /*nullifier=*/ value0, tracedLeafIndex, exists, @@ -491,10 +487,7 @@ describe('AVM simulator: transpiled Noir contracts', () => { expect(results.output).toEqual([]); expect(trace.traceNewNoteHash).toHaveBeenCalledTimes(1); - expect(trace.traceNewNoteHash).toHaveBeenCalledWith( - expect.objectContaining(storageAddress), - /*noteHash=*/ value0, - ); + expect(trace.traceNewNoteHash).toHaveBeenCalledWith(expect.objectContaining(address), /*noteHash=*/ value0); }); it('Should append a new nullifier correctly', async () => { @@ -507,10 +500,7 @@ describe('AVM simulator: transpiled Noir contracts', () => { expect(results.output).toEqual([]); expect(trace.traceNewNullifier).toHaveBeenCalledTimes(1); - expect(trace.traceNewNullifier).toHaveBeenCalledWith( - expect.objectContaining(storageAddress), - /*nullifier=*/ value0, - ); + expect(trace.traceNewNullifier).toHaveBeenCalledWith(expect.objectContaining(address), /*nullifier=*/ value0); }); describe('Cached nullifiers', () => { @@ -525,14 +515,11 @@ describe('AVM simulator: transpiled Noir contracts', () => { // New nullifier and nullifier existence check should be traced expect(trace.traceNewNullifier).toHaveBeenCalledTimes(1); - expect(trace.traceNewNullifier).toHaveBeenCalledWith( - expect.objectContaining(storageAddress), - /*nullifier=*/ value0, - ); + expect(trace.traceNewNullifier).toHaveBeenCalledWith(expect.objectContaining(address), /*nullifier=*/ value0); expect(trace.traceNullifierCheck).toHaveBeenCalledTimes(1); // leafIndex is returned from DB call for nullifiers, so it is absent on DB miss expect(trace.traceNullifierCheck).toHaveBeenCalledWith( - storageAddress, + address, /*nullifier=*/ value0, /*leafIndex=*/ Fr.ZERO, /*exists=*/ true, @@ -551,10 +538,7 @@ describe('AVM simulator: transpiled Noir contracts', () => { // Nullifier should be traced exactly once expect(trace.traceNewNullifier).toHaveBeenCalledTimes(1); - expect(trace.traceNewNullifier).toHaveBeenCalledWith( - expect.objectContaining(storageAddress), - /*nullifier=*/ value0, - ); + expect(trace.traceNewNullifier).toHaveBeenCalledWith(expect.objectContaining(address), /*nullifier=*/ value0); }); }); @@ -590,10 +574,10 @@ describe('AVM simulator: transpiled Noir contracts', () => { const results = await new AvmSimulator(context).executeBytecode(bytecode); expect(results.reverted).toBe(false); - expect(await context.persistableState.peekStorage(storageAddress, slot)).toEqual(value0); + expect(await context.persistableState.peekStorage(address, slot)).toEqual(value0); expect(trace.tracePublicStorageWrite).toHaveBeenCalledTimes(1); - expect(trace.tracePublicStorageWrite).toHaveBeenCalledWith(storageAddress, slot, value0); + expect(trace.tracePublicStorageWrite).toHaveBeenCalledWith(address, slot, value0); }); it('Should read value in storage (single)', async () => { @@ -608,7 +592,7 @@ describe('AVM simulator: transpiled Noir contracts', () => { expect(trace.tracePublicStorageRead).toHaveBeenCalledTimes(1); expect(trace.tracePublicStorageRead).toHaveBeenCalledWith( - storageAddress, + address, slot, value0, /*exists=*/ true, @@ -627,10 +611,10 @@ describe('AVM simulator: transpiled Noir contracts', () => { expect(results.output).toEqual([value0]); expect(trace.tracePublicStorageWrite).toHaveBeenCalledTimes(1); - expect(trace.tracePublicStorageWrite).toHaveBeenCalledWith(storageAddress, slot, value0); + expect(trace.tracePublicStorageWrite).toHaveBeenCalledWith(address, slot, value0); expect(trace.tracePublicStorageRead).toHaveBeenCalledTimes(1); expect(trace.tracePublicStorageRead).toHaveBeenCalledWith( - storageAddress, + address, slot, value0, /*exists=*/ true, @@ -647,12 +631,12 @@ describe('AVM simulator: transpiled Noir contracts', () => { const results = await new AvmSimulator(context).executeBytecode(bytecode); expect(results.reverted).toBe(false); - expect(await context.persistableState.peekStorage(storageAddress, listSlot0)).toEqual(calldata[0]); - expect(await context.persistableState.peekStorage(storageAddress, listSlot1)).toEqual(calldata[1]); + expect(await context.persistableState.peekStorage(address, listSlot0)).toEqual(calldata[0]); + expect(await context.persistableState.peekStorage(address, listSlot1)).toEqual(calldata[1]); expect(trace.tracePublicStorageWrite).toHaveBeenCalledTimes(2); - expect(trace.tracePublicStorageWrite).toHaveBeenCalledWith(storageAddress, listSlot0, value0); - expect(trace.tracePublicStorageWrite).toHaveBeenCalledWith(storageAddress, listSlot1, value1); + expect(trace.tracePublicStorageWrite).toHaveBeenCalledWith(address, listSlot0, value0); + expect(trace.tracePublicStorageWrite).toHaveBeenCalledWith(address, listSlot1, value1); }); it('Should read a value in storage (list)', async () => { @@ -670,14 +654,14 @@ describe('AVM simulator: transpiled Noir contracts', () => { expect(results.output).toEqual([value0, value1]); expect(trace.tracePublicStorageRead).toHaveBeenCalledWith( - storageAddress, + address, listSlot0, value0, /*exists=*/ true, /*cached=*/ false, ); expect(trace.tracePublicStorageRead).toHaveBeenCalledWith( - storageAddress, + address, listSlot1, value1, /*exists=*/ true, @@ -686,7 +670,7 @@ describe('AVM simulator: transpiled Noir contracts', () => { }); it('Should set a value in storage (map)', async () => { - const calldata = [storageAddress, value0]; + const calldata = [address, value0]; const context = createContext(calldata); const bytecode = getAvmTestContractBytecode('set_storage_map'); @@ -698,14 +682,14 @@ describe('AVM simulator: transpiled Noir contracts', () => { const mapSlotNumber = results.output[0].toBigInt(); const mapSlot = new Fr(mapSlotNumber); - expect(await context.persistableState.peekStorage(storageAddress, mapSlot)).toEqual(value0); + expect(await context.persistableState.peekStorage(address, mapSlot)).toEqual(value0); expect(trace.tracePublicStorageWrite).toHaveBeenCalledTimes(1); - expect(trace.tracePublicStorageWrite).toHaveBeenCalledWith(storageAddress, mapSlot, value0); + expect(trace.tracePublicStorageWrite).toHaveBeenCalledWith(address, mapSlot, value0); }); it('Should read-add-set a value in storage (map)', async () => { - const calldata = [storageAddress, value0]; + const calldata = [address, value0]; const context = createContext(calldata); const bytecode = getAvmTestContractBytecode('add_storage_map'); @@ -717,22 +701,22 @@ describe('AVM simulator: transpiled Noir contracts', () => { const mapSlotNumber = results.output[0].toBigInt(); const mapSlot = new Fr(mapSlotNumber); - expect(await context.persistableState.peekStorage(storageAddress, mapSlot)).toEqual(value0); + expect(await context.persistableState.peekStorage(address, mapSlot)).toEqual(value0); expect(trace.tracePublicStorageRead).toHaveBeenCalledTimes(1); expect(trace.tracePublicStorageRead).toHaveBeenCalledWith( - storageAddress, + address, mapSlot, Fr.ZERO, /*exists=*/ false, /*cached=*/ false, ); expect(trace.tracePublicStorageWrite).toHaveBeenCalledTimes(1); - expect(trace.tracePublicStorageWrite).toHaveBeenCalledWith(storageAddress, mapSlot, value0); + expect(trace.tracePublicStorageWrite).toHaveBeenCalledWith(address, mapSlot, value0); }); it('Should read value in storage (map)', async () => { - const calldata = [storageAddress]; + const calldata = [address]; const context = createContext(calldata); mockStorageRead(hostStorage, value0); @@ -745,7 +729,7 @@ describe('AVM simulator: transpiled Noir contracts', () => { expect(trace.tracePublicStorageRead).toHaveBeenCalledTimes(1); // slot is the result of a pedersen hash and is therefore not known in the test expect(trace.tracePublicStorageRead).toHaveBeenCalledWith( - storageAddress, + address, expect.anything(), value0, /*exists=*/ true, diff --git a/yarn-project/simulator/src/avm/fixtures/index.ts b/yarn-project/simulator/src/avm/fixtures/index.ts index e15c820fa33..3588055bd39 100644 --- a/yarn-project/simulator/src/avm/fixtures/index.ts +++ b/yarn-project/simulator/src/avm/fixtures/index.ts @@ -78,7 +78,6 @@ export function initPersistableStateManager(overrides?: { export function initExecutionEnvironment(overrides?: Partial): AvmExecutionEnvironment { return new AvmExecutionEnvironment( overrides?.address ?? AztecAddress.zero(), - overrides?.storageAddress ?? AztecAddress.zero(), overrides?.sender ?? AztecAddress.zero(), overrides?.functionSelector ?? FunctionSelector.empty(), overrides?.contractCallDepth ?? Fr.zero(), diff --git a/yarn-project/simulator/src/avm/journal/journal.test.ts b/yarn-project/simulator/src/avm/journal/journal.test.ts index 9818c42be4b..00c21520cc0 100644 --- a/yarn-project/simulator/src/avm/journal/journal.test.ts +++ b/yarn-project/simulator/src/avm/journal/journal.test.ts @@ -218,20 +218,20 @@ describe('journal', () => { // // We first read value from t0, then value from t1 // expect(journalUpdates.storageReads).toEqual([ // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // exists: true, // slot: key, // value: value, // }), // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // exists: true, // slot: key, // value: valueT1, // }), // // Read a third time to check storage // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // exists: true, // slot: key, // value: valueT1, @@ -241,20 +241,20 @@ describe('journal', () => { // // We first write value from t0, then value from t1 // expect(journalUpdates.storageWrites).toEqual([ // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // slot: key, // value: value, // }), // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // slot: key, // value: valueT1, // }), // ]); // expect(journalUpdates.noteHashes).toEqual([ - // expect.objectContaining({ noteHash: commitment, storageAddress: contractAddress }), - // expect.objectContaining({ noteHash: commitmentT1, storageAddress: contractAddress }), + // expect.objectContaining({ noteHash: commitment, address: contractAddress }), + // expect.objectContaining({ noteHash: commitmentT1, address: contractAddress }), // ]); // expect(journalUpdates.newLogs).toEqual([ // new UnencryptedL2Log( @@ -278,11 +278,11 @@ describe('journal', () => { // ]); // expect(journalUpdates.nullifiers).toEqual([ // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // nullifier: commitment, // }), // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // nullifier: commitmentT1, // }), // ]); @@ -351,20 +351,20 @@ describe('journal', () => { // // We first read value from t0, then value from t1 // expect(journalUpdates.storageReads).toEqual([ // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // exists: true, // slot: key, // value: value, // }), // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // exists: true, // slot: key, // value: valueT1, // }), // // Read a third time to check storage // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // exists: true, // slot: key, // value: value, @@ -374,12 +374,12 @@ describe('journal', () => { // // We first write value from t0, then value from t1 // expect(journalUpdates.storageWrites).toEqual([ // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // slot: key, // value: value, // }), // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // slot: key, // value: valueT1, // }), @@ -387,8 +387,8 @@ describe('journal', () => { // // Check that the world state _traces_ are merged even on rejection // expect(journalUpdates.noteHashes).toEqual([ - // expect.objectContaining({ noteHash: commitment, storageAddress: contractAddress }), - // expect.objectContaining({ noteHash: commitmentT1, storageAddress: contractAddress }), + // expect.objectContaining({ noteHash: commitment, address: contractAddress }), + // expect.objectContaining({ noteHash: commitmentT1, address: contractAddress }), // ]); // expect(journalUpdates.nullifierChecks).toEqual([ // expect.objectContaining({ nullifier: commitment, exists: true }), @@ -396,11 +396,11 @@ describe('journal', () => { // ]); // expect(journalUpdates.nullifiers).toEqual([ // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // nullifier: commitment, // }), // expect.objectContaining({ - // storageAddress: contractAddress, + // address: contractAddress, // nullifier: commitmentT1, // }), // ]); diff --git a/yarn-project/simulator/src/avm/journal/journal.ts b/yarn-project/simulator/src/avm/journal/journal.ts index f34a2832edd..bbec7914e77 100644 --- a/yarn-project/simulator/src/avm/journal/journal.ts +++ b/yarn-project/simulator/src/avm/journal/journal.ts @@ -70,44 +70,44 @@ export class AvmPersistableStateManager { /** * Write to public storage, journal/trace the write. * - * @param storageAddress - the address of the contract whose storage is being written to + * @param address - the address of the contract whose storage is being written to * @param slot - the slot in the contract's storage being written to * @param value - the value being written to the slot */ - public writeStorage(storageAddress: Fr, slot: Fr, value: Fr) { - this.log.debug(`Storage write (address=${storageAddress}, slot=${slot}): value=${value}`); + public writeStorage(address: Fr, slot: Fr, value: Fr) { + this.log.debug(`Storage write (address=${address}, slot=${slot}): value=${value}`); // Cache storage writes for later reference/reads - this.publicStorage.write(storageAddress, slot, value); - this.trace.tracePublicStorageWrite(storageAddress, slot, value); + this.publicStorage.write(address, slot, value); + this.trace.tracePublicStorageWrite(address, slot, value); } /** * Read from public storage, trace the read. * - * @param storageAddress - the address of the contract whose storage is being read from + * @param address - the address of the contract whose storage is being read from * @param slot - the slot in the contract's storage being read from * @returns the latest value written to slot, or 0 if never written to before */ - public async readStorage(storageAddress: Fr, slot: Fr): Promise { - const { value, exists, cached } = await this.publicStorage.read(storageAddress, slot); + public async readStorage(address: Fr, slot: Fr): Promise { + const { value, exists, cached } = await this.publicStorage.read(address, slot); this.log.debug( - `Storage read (address=${storageAddress}, slot=${slot}): value=${value}, exists=${exists}, cached=${cached}`, + `Storage read (address=${address}, slot=${slot}): value=${value}, exists=${exists}, cached=${cached}`, ); - this.trace.tracePublicStorageRead(storageAddress, slot, value, exists, cached); + this.trace.tracePublicStorageRead(address, slot, value, exists, cached); return Promise.resolve(value); } /** * Read from public storage, don't trace the read. * - * @param storageAddress - the address of the contract whose storage is being read from + * @param address - the address of the contract whose storage is being read from * @param slot - the slot in the contract's storage being read from * @returns the latest value written to slot, or 0 if never written to before */ - public async peekStorage(storageAddress: Fr, slot: Fr): Promise { - const { value, exists, cached } = await this.publicStorage.read(storageAddress, slot); + public async peekStorage(address: Fr, slot: Fr): Promise { + const { value, exists, cached } = await this.publicStorage.read(address, slot); this.log.debug( - `Storage peek (address=${storageAddress}, slot=${slot}): value=${value}, exists=${exists}, cached=${cached}`, + `Storage peek (address=${address}, slot=${slot}): value=${value}, exists=${exists}, cached=${cached}`, ); return Promise.resolve(value); } @@ -116,16 +116,16 @@ export class AvmPersistableStateManager { /** * Check if a note hash exists at the given leaf index, trace the check. * - * @param storageAddress - the address of the contract whose storage is being read from + * @param address - the address of the contract whose storage is being read from * @param noteHash - the unsiloed note hash being checked * @param leafIndex - the leaf index being checked * @returns true if the note hash exists at the given leaf index, false otherwise */ - public async checkNoteHashExists(storageAddress: Fr, noteHash: Fr, leafIndex: Fr): Promise { + public async checkNoteHashExists(address: Fr, noteHash: Fr, leafIndex: Fr): Promise { const gotLeafIndex = await this.hostStorage.commitmentsDb.getCommitmentIndex(noteHash); const exists = gotLeafIndex === leafIndex.toBigInt(); - this.log.debug(`noteHashes(${storageAddress})@${noteHash} ?? leafIndex: ${leafIndex}, exists: ${exists}.`); - this.trace.traceNoteHashCheck(storageAddress, noteHash, leafIndex, exists); + this.log.debug(`noteHashes(${address})@${noteHash} ?? leafIndex: ${leafIndex}, exists: ${exists}.`); + this.trace.traceNoteHashCheck(address, noteHash, leafIndex, exists); return Promise.resolve(exists); } @@ -133,37 +133,37 @@ export class AvmPersistableStateManager { * Write a note hash, trace the write. * @param noteHash - the unsiloed note hash to write */ - public writeNoteHash(storageAddress: Fr, noteHash: Fr) { - this.log.debug(`noteHashes(${storageAddress}) += @${noteHash}.`); - this.trace.traceNewNoteHash(storageAddress, noteHash); + public writeNoteHash(address: Fr, noteHash: Fr) { + this.log.debug(`noteHashes(${address}) += @${noteHash}.`); + this.trace.traceNewNoteHash(address, noteHash); } /** * Check if a nullifier exists, trace the check. - * @param storageAddress - address of the contract that the nullifier is associated with + * @param address - address of the contract that the nullifier is associated with * @param nullifier - the unsiloed nullifier to check * @returns exists - whether the nullifier exists in the nullifier set */ - public async checkNullifierExists(storageAddress: Fr, nullifier: Fr): Promise { - const [exists, isPending, leafIndex] = await this.nullifiers.checkExists(storageAddress, nullifier); + public async checkNullifierExists(address: Fr, nullifier: Fr): Promise { + const [exists, isPending, leafIndex] = await this.nullifiers.checkExists(address, nullifier); this.log.debug( - `nullifiers(${storageAddress})@${nullifier} ?? leafIndex: ${leafIndex}, exists: ${exists}, pending: ${isPending}.`, + `nullifiers(${address})@${nullifier} ?? leafIndex: ${leafIndex}, exists: ${exists}, pending: ${isPending}.`, ); - this.trace.traceNullifierCheck(storageAddress, nullifier, leafIndex, exists, isPending); + this.trace.traceNullifierCheck(address, nullifier, leafIndex, exists, isPending); return Promise.resolve(exists); } /** * Write a nullifier to the nullifier set, trace the write. - * @param storageAddress - address of the contract that the nullifier is associated with + * @param address - address of the contract that the nullifier is associated with * @param nullifier - the unsiloed nullifier to write */ - public async writeNullifier(storageAddress: Fr, nullifier: Fr) { - this.log.debug(`nullifiers(${storageAddress}) += ${nullifier}.`); + public async writeNullifier(address: Fr, nullifier: Fr) { + this.log.debug(`nullifiers(${address}) += ${nullifier}.`); // Cache pending nullifiers for later access - await this.nullifiers.append(storageAddress, nullifier); + await this.nullifiers.append(address, nullifier); // Trace all nullifier creations (even reverted ones) - this.trace.traceNewNullifier(storageAddress, nullifier); + this.trace.traceNewNullifier(address, nullifier); } /** diff --git a/yarn-project/simulator/src/avm/journal/nullifiers.ts b/yarn-project/simulator/src/avm/journal/nullifiers.ts index a4d23a357e2..4806b544492 100644 --- a/yarn-project/simulator/src/avm/journal/nullifiers.ts +++ b/yarn-project/simulator/src/avm/journal/nullifiers.ts @@ -37,17 +37,17 @@ export class NullifierManager { /** * Get a nullifier's existence in this' cache or parent's (recursively). * DOES NOT CHECK HOST STORAGE! - * @param storageAddress - the address of the contract whose storage is being read from + * @param address - the address of the contract whose storage is being read from * @param nullifier - the nullifier to check for * @returns exists: whether the nullifier exists in cache here or in parent's */ - private checkExistsHereOrParent(storageAddress: Fr, nullifier: Fr): boolean { + private checkExistsHereOrParent(address: Fr, nullifier: Fr): boolean { // First check this cache - let existsAsPending = this.cache.exists(storageAddress, nullifier); + let existsAsPending = this.cache.exists(address, nullifier); // Then try parent's nullifier cache if (!existsAsPending && this.parent) { // Note: this will recurse to grandparent/etc until a cache-hit is encountered. - existsAsPending = this.parent.checkExistsHereOrParent(storageAddress, nullifier); + existsAsPending = this.parent.checkExistsHereOrParent(address, nullifier); } return existsAsPending; } @@ -59,24 +59,24 @@ export class NullifierManager { * 3. Fall back to the host state. * 4. Not found! Nullifier does not exist. * - * @param storageAddress - the address of the contract whose storage is being read from + * @param address - the address of the contract whose storage is being read from * @param nullifier - the nullifier to check for * @returns exists: whether the nullifier exists at all, * isPending: whether the nullifier was found in a cache, * leafIndex: the nullifier's leaf index if it exists and is not pending (comes from host state). */ public async checkExists( - storageAddress: Fr, + address: Fr, nullifier: Fr, ): Promise<[/*exists=*/ boolean, /*isPending=*/ boolean, /*leafIndex=*/ Fr]> { // Check this cache and parent's (recursively) - const existsAsPending = this.checkExistsHereOrParent(storageAddress, nullifier); + const existsAsPending = this.checkExistsHereOrParent(address, nullifier); // Finally try the host's Aztec state (a trip to the database) // If the value is found in the database, it will be associated with a leaf index! let leafIndex: bigint | undefined = undefined; if (!existsAsPending) { // silo the nullifier before checking for its existence in the host - leafIndex = await this.hostNullifiers.getNullifierIndex(siloNullifier(storageAddress, nullifier)); + leafIndex = await this.hostNullifiers.getNullifierIndex(siloNullifier(address, nullifier)); } const exists = existsAsPending || leafIndex !== undefined; leafIndex = leafIndex === undefined ? BigInt(0) : leafIndex; @@ -86,17 +86,17 @@ export class NullifierManager { /** * Stage a new nullifier (append it to the cache). * - * @param storageAddress - the address of the contract that the nullifier is associated with + * @param address - the address of the contract that the nullifier is associated with * @param nullifier - the nullifier to stage */ - public async append(storageAddress: Fr, nullifier: Fr) { - const [exists, ,] = await this.checkExists(storageAddress, nullifier); + public async append(address: Fr, nullifier: Fr) { + const [exists, ,] = await this.checkExists(address, nullifier); if (exists) { throw new NullifierCollisionError( - `Nullifier ${nullifier} at contract ${storageAddress} already exists in parent cache or host.`, + `Nullifier ${nullifier} at contract ${address} already exists in parent cache or host.`, ); } - this.cache.append(storageAddress, nullifier); + this.cache.append(address, nullifier); } /** @@ -117,7 +117,7 @@ export class NullifierManager { export class NullifierCache { /** * Map for staging nullifiers. - * One inner-set per contract storage address, + * One inner-set per contract address, * each entry being a nullifier. */ private cachePerContract: Map> = new Map(); @@ -135,35 +135,33 @@ export class NullifierCache { /** * Check whether a nullifier exists in the cache. * - * @param storageAddress - the address of the contract that the nullifier is associated with + * @param address - the address of the contract that the nullifier is associated with * @param nullifier - the nullifier to check existence of * @returns whether the nullifier is found in the cache */ - public exists(storageAddress: Fr, nullifier: Fr): boolean { + public exists(address: Fr, nullifier: Fr): boolean { const exists = - this.cachePerContract.get(storageAddress.toBigInt())?.has(nullifier.toBigInt()) || - this.siloedNullifiers.has(siloNullifier(AztecAddress.fromField(storageAddress), nullifier).toBigInt()); + this.cachePerContract.get(address.toBigInt())?.has(nullifier.toBigInt()) || + this.siloedNullifiers.has(siloNullifier(AztecAddress.fromField(address), nullifier).toBigInt()); return !!exists; } /** * Stage a new nullifier (append it to the cache). * - * @param storageAddress - the address of the contract that the nullifier is associated with + * @param address - the address of the contract that the nullifier is associated with * @param nullifier - the nullifier to stage */ - public append(storageAddress: Fr, nullifier: Fr) { - if (this.exists(storageAddress, nullifier)) { - throw new NullifierCollisionError( - `Nullifier ${nullifier} at contract ${storageAddress} already exists in cache.`, - ); + public append(address: Fr, nullifier: Fr) { + if (this.exists(address, nullifier)) { + throw new NullifierCollisionError(`Nullifier ${nullifier} at contract ${address} already exists in cache.`); } - let nullifiersForContract = this.cachePerContract.get(storageAddress.toBigInt()); + let nullifiersForContract = this.cachePerContract.get(address.toBigInt()); // If this contract's nullifier set has no cached nullifiers, create a new Set to store them if (!nullifiersForContract) { nullifiersForContract = new Set(); - this.cachePerContract.set(storageAddress.toBigInt(), nullifiersForContract); + this.cachePerContract.set(address.toBigInt(), nullifiersForContract); } nullifiersForContract.add(nullifier.toBigInt()); } diff --git a/yarn-project/simulator/src/avm/journal/public_storage.ts b/yarn-project/simulator/src/avm/journal/public_storage.ts index 443717963db..a6b171df8b5 100644 --- a/yarn-project/simulator/src/avm/journal/public_storage.ts +++ b/yarn-project/simulator/src/avm/journal/public_storage.ts @@ -45,17 +45,17 @@ export class PublicStorage { * Read a storage value from this' cache or parent's (recursively). * DOES NOT CHECK HOST STORAGE! * - * @param storageAddress - the address of the contract whose storage is being read from + * @param address - the address of the contract whose storage is being read from * @param slot - the slot in the contract's storage being read from * @returns value: the latest value written according to this cache or the parent's. undefined on cache miss. */ - public readHereOrParent(storageAddress: Fr, slot: Fr): Fr | undefined { + public readHereOrParent(address: Fr, slot: Fr): Fr | undefined { // First try check this storage cache - let value = this.cache.read(storageAddress, slot); + let value = this.cache.read(address, slot); // Then try parent's storage cache if (!value && this.parent) { // Note: this will recurse to grandparent/etc until a cache-hit is encountered. - value = this.parent.readHereOrParent(storageAddress, slot); + value = this.parent.readHereOrParent(address, slot); } return value; } @@ -67,17 +67,17 @@ export class PublicStorage { * 3. Fall back to the host state. * 4. Not found! Value has never been written to before. Flag it as non-existent and return value zero. * - * @param storageAddress - the address of the contract whose storage is being read from + * @param address - the address of the contract whose storage is being read from * @param slot - the slot in the contract's storage being read from * @returns exists: whether the slot has EVER been written to before, value: the latest value written to slot, or 0 if never written to before */ - public async read(storageAddress: Fr, slot: Fr): Promise { + public async read(address: Fr, slot: Fr): Promise { let cached = false; // Check this cache and parent's (recursively) - let value = this.readHereOrParent(storageAddress, slot); + let value = this.readHereOrParent(address, slot); // Finally try the host's Aztec state (a trip to the database) if (!value) { - value = await this.hostPublicStorage.storageRead(storageAddress, slot); + value = await this.hostPublicStorage.storageRead(address, slot); // TODO(dbanks12): if value retrieved from host storage, we can cache it here // any future reads to the same slot can read from cache instead of more expensive // DB access @@ -93,12 +93,12 @@ export class PublicStorage { /** * Stage a storage write. * - * @param storageAddress - the address of the contract whose storage is being written to + * @param address - the address of the contract whose storage is being written to * @param slot - the slot in the contract's storage being written to * @param value - the value being written to the slot */ - public write(storageAddress: Fr, slot: Fr, value: Fr) { - this.cache.write(storageAddress, slot, value); + public write(address: Fr, slot: Fr, value: Fr) { + this.cache.write(address, slot, value); } /** @@ -114,9 +114,9 @@ export class PublicStorage { * Commits ALL staged writes to the host's state. */ public async commitToDB() { - for (const [storageAddress, cacheAtContract] of this.cache.cachePerContract) { + for (const [address, cacheAtContract] of this.cache.cachePerContract) { for (const [slot, value] of cacheAtContract) { - await this.hostPublicStorage.storageWrite(AztecAddress.fromBigInt(storageAddress), new Fr(slot), value); + await this.hostPublicStorage.storageWrite(AztecAddress.fromBigInt(address), new Fr(slot), value); } } } @@ -130,7 +130,7 @@ export class PublicStorage { class PublicStorageCache { /** * Map for staging storage writes. - * One inner-map per contract storage address, + * One inner-map per contract address, * mapping storage slot to latest staged write value. */ public cachePerContract: Map> = new Map(); @@ -139,27 +139,27 @@ class PublicStorageCache { /** * Read a staged value from storage, if it has been previously written to. * - * @param storageAddress - the address of the contract whose storage is being read from + * @param address - the address of the contract whose storage is being read from * @param slot - the slot in the contract's storage being read from * @returns the latest value written to slot, or undefined if no value has been written */ - public read(storageAddress: Fr, slot: Fr): Fr | undefined { - return this.cachePerContract.get(storageAddress.toBigInt())?.get(slot.toBigInt()); + public read(address: Fr, slot: Fr): Fr | undefined { + return this.cachePerContract.get(address.toBigInt())?.get(slot.toBigInt()); } /** * Stage a storage write. * - * @param storageAddress - the address of the contract whose storage is being written to + * @param address - the address of the contract whose storage is being written to * @param slot - the slot in the contract's storage being written to * @param value - the value being written to the slot */ - public write(storageAddress: Fr, slot: Fr, value: Fr) { - let cacheAtContract = this.cachePerContract.get(storageAddress.toBigInt()); + public write(address: Fr, slot: Fr, value: Fr) { + let cacheAtContract = this.cachePerContract.get(address.toBigInt()); if (!cacheAtContract) { // If this contract's storage has no staged modifications, create a new inner map to store them cacheAtContract = new Map(); - this.cachePerContract.set(storageAddress.toBigInt(), cacheAtContract); + this.cachePerContract.set(address.toBigInt(), cacheAtContract); } cacheAtContract.set(slot.toBigInt(), value); } diff --git a/yarn-project/simulator/src/avm/opcodes/accrued_substate.test.ts b/yarn-project/simulator/src/avm/opcodes/accrued_substate.test.ts index dd1e638d6a4..3088e2c043c 100644 --- a/yarn-project/simulator/src/avm/opcodes/accrued_substate.test.ts +++ b/yarn-project/simulator/src/avm/opcodes/accrued_substate.test.ts @@ -32,7 +32,6 @@ describe('Accrued Substate', () => { let context: AvmContext; const address = new Fr(1); - const storageAddress = new Fr(2); const sender = new Fr(42); const value0 = new Fr(69); // noteHash or nullifier... const value0Offset = 100; @@ -46,7 +45,7 @@ describe('Accrued Substate', () => { hostStorage = initHostStorage(); trace = mock(); persistableState = initPersistableStateManager({ hostStorage, trace }); - context = initContext({ persistableState, env: initExecutionEnvironment({ address, storageAddress, sender }) }); + context = initContext({ persistableState, env: initExecutionEnvironment({ address, sender }) }); }); describe('NoteHashExists', () => { @@ -100,7 +99,7 @@ describe('Accrued Substate', () => { expect(trace.traceNoteHashCheck).toHaveBeenCalledTimes(1); expect(trace.traceNoteHashCheck).toHaveBeenCalledWith( - storageAddress, + address, /*noteHash=*/ value0, leafIndex, /*exists=*/ expectFound, @@ -126,10 +125,7 @@ describe('Accrued Substate', () => { context.machineState.memory.set(value0Offset, new Field(value0)); await new EmitNoteHash(/*indirect=*/ 0, /*offset=*/ value0Offset).execute(context); expect(trace.traceNewNoteHash).toHaveBeenCalledTimes(1); - expect(trace.traceNewNoteHash).toHaveBeenCalledWith( - expect.objectContaining(storageAddress), - /*noteHash=*/ value0, - ); + expect(trace.traceNewNoteHash).toHaveBeenCalledWith(expect.objectContaining(address), /*noteHash=*/ value0); }); }); @@ -156,18 +152,18 @@ describe('Accrued Substate', () => { describe.each([[/*exists=*/ false], [/*exists=*/ true]])('Nullifier checks', (exists: boolean) => { const existsStr = exists ? 'DOES exist' : 'does NOT exist'; it(`Should return ${exists} (and be traced) when noteHash ${existsStr}`, async () => { - const storageAddressOffset = 1; + const addressOffset = 1; if (exists) { mockNullifierExists(hostStorage, leafIndex, value0); } context.machineState.memory.set(value0Offset, new Field(value0)); // nullifier - context.machineState.memory.set(storageAddressOffset, new Field(storageAddress)); + context.machineState.memory.set(addressOffset, new Field(address)); await new NullifierExists( /*indirect=*/ 0, /*nullifierOffset=*/ value0Offset, - storageAddressOffset, + addressOffset, existsOffset, ).execute(context); @@ -179,7 +175,7 @@ describe('Accrued Substate', () => { // leafIndex is returned from DB call for nullifiers, so it is absent on DB miss const tracedLeafIndex = exists && !isPending ? leafIndex : Fr.ZERO; expect(trace.traceNullifierCheck).toHaveBeenCalledWith( - storageAddress, + address, /*nullifier=*/ value0, tracedLeafIndex, exists, @@ -206,34 +202,24 @@ describe('Accrued Substate', () => { context.machineState.memory.set(value0Offset, new Field(value0)); await new EmitNullifier(/*indirect=*/ 0, /*offset=*/ value0Offset).execute(context); expect(trace.traceNewNullifier).toHaveBeenCalledTimes(1); - expect(trace.traceNewNullifier).toHaveBeenCalledWith( - expect.objectContaining(storageAddress), - /*nullifier=*/ value0, - ); + expect(trace.traceNewNullifier).toHaveBeenCalledWith(expect.objectContaining(address), /*nullifier=*/ value0); }); it('Nullifier collision reverts (same nullifier emitted twice)', async () => { context.machineState.memory.set(value0Offset, new Field(value0)); await new EmitNullifier(/*indirect=*/ 0, /*offset=*/ value0Offset).execute(context); await expect(new EmitNullifier(/*indirect=*/ 0, /*offset=*/ value0Offset).execute(context)).rejects.toThrow( - new InstructionExecutionError( - `Attempted to emit duplicate nullifier ${value0} (storage address: ${storageAddress}).`, - ), + new InstructionExecutionError(`Attempted to emit duplicate nullifier ${value0} (address: ${address}).`), ); expect(trace.traceNewNullifier).toHaveBeenCalledTimes(1); - expect(trace.traceNewNullifier).toHaveBeenCalledWith( - expect.objectContaining(storageAddress), - /*nullifier=*/ value0, - ); + expect(trace.traceNewNullifier).toHaveBeenCalledWith(expect.objectContaining(address), /*nullifier=*/ value0); }); it('Nullifier collision reverts (nullifier exists in host state)', async () => { mockNullifierExists(hostStorage, leafIndex); // db will say that nullifier already exists context.machineState.memory.set(value0Offset, new Field(value0)); await expect(new EmitNullifier(/*indirect=*/ 0, /*offset=*/ value0Offset).execute(context)).rejects.toThrow( - new InstructionExecutionError( - `Attempted to emit duplicate nullifier ${value0} (storage address: ${storageAddress}).`, - ), + new InstructionExecutionError(`Attempted to emit duplicate nullifier ${value0} (address: ${address}).`), ); expect(trace.traceNewNullifier).toHaveBeenCalledTimes(0); // the only attempt should fail before tracing }); diff --git a/yarn-project/simulator/src/avm/opcodes/accrued_substate.ts b/yarn-project/simulator/src/avm/opcodes/accrued_substate.ts index 1a7277d9515..9b4cea23f41 100644 --- a/yarn-project/simulator/src/avm/opcodes/accrued_substate.ts +++ b/yarn-project/simulator/src/avm/opcodes/accrued_substate.ts @@ -41,11 +41,7 @@ export class NoteHashExists extends Instruction { const noteHash = memory.get(noteHashOffset).toFr(); const leafIndex = memory.get(leafIndexOffset).toFr(); - const exists = await context.persistableState.checkNoteHashExists( - context.environment.storageAddress, - noteHash, - leafIndex, - ); + const exists = await context.persistableState.checkNoteHashExists(context.environment.address, noteHash, leafIndex); memory.set(existsOffset, exists ? new Uint8(1) : new Uint8(0)); memory.assert(memoryOperations); @@ -76,7 +72,7 @@ export class EmitNoteHash extends Instruction { } const noteHash = memory.get(noteHashOffset).toFr(); - context.persistableState.writeNoteHash(context.environment.storageAddress, noteHash); + context.persistableState.writeNoteHash(context.environment.address, noteHash); memory.assert(memoryOperations); context.machineState.incrementPc(); @@ -150,12 +146,12 @@ export class EmitNullifier extends Instruction { const nullifier = memory.get(nullifierOffset).toFr(); try { - await context.persistableState.writeNullifier(context.environment.storageAddress, nullifier); + await context.persistableState.writeNullifier(context.environment.address, nullifier); } catch (e) { if (e instanceof NullifierCollisionError) { // Error is known/expected, raise as InstructionExecutionError that the will lead the simulator to revert this call throw new InstructionExecutionError( - `Attempted to emit duplicate nullifier ${nullifier} (storage address: ${context.environment.storageAddress}).`, + `Attempted to emit duplicate nullifier ${nullifier} (address: ${context.environment.address}).`, ); } else { throw e; diff --git a/yarn-project/simulator/src/avm/opcodes/environment_getters.test.ts b/yarn-project/simulator/src/avm/opcodes/environment_getters.test.ts index abf0b7e3936..853b1af219a 100644 --- a/yarn-project/simulator/src/avm/opcodes/environment_getters.test.ts +++ b/yarn-project/simulator/src/avm/opcodes/environment_getters.test.ts @@ -16,7 +16,6 @@ import { FeePerL2Gas, FunctionSelector, Sender, - StorageAddress, Timestamp, TransactionFee, Version, @@ -24,7 +23,6 @@ import { type GetterInstruction = | typeof Sender - | typeof StorageAddress | typeof Address | typeof FunctionSelector | typeof TransactionFee @@ -37,7 +35,6 @@ type GetterInstruction = describe('Environment getters', () => { const address = AztecAddress.random(); - const storageAddress = AztecAddress.random(); const sender = AztecAddress.random(); const functionSelector = FunctionSelectorType.random(); const transactionFee = Fr.random(); @@ -57,7 +54,6 @@ describe('Environment getters', () => { }); const env = initExecutionEnvironment({ address, - storageAddress, sender, functionSelector, transactionFee, @@ -70,7 +66,6 @@ describe('Environment getters', () => { describe.each([ [Address, address.toField()], - [StorageAddress, storageAddress.toField()], [Sender, sender.toField()], [FunctionSelector, functionSelector.toField(), TypeTag.UINT32], [TransactionFee, transactionFee.toField()], diff --git a/yarn-project/simulator/src/avm/opcodes/environment_getters.ts b/yarn-project/simulator/src/avm/opcodes/environment_getters.ts index 6373382acf6..4f6c5f53f6e 100644 --- a/yarn-project/simulator/src/avm/opcodes/environment_getters.ts +++ b/yarn-project/simulator/src/avm/opcodes/environment_getters.ts @@ -21,15 +21,6 @@ export class Address extends EnvironmentGetterInstruction { } } -export class StorageAddress extends EnvironmentGetterInstruction { - static type: string = 'STORAGEADDRESS'; - static readonly opcode: Opcode = Opcode.STORAGEADDRESS; - - protected getEnvironmentValue(env: AvmExecutionEnvironment) { - return new Field(env.storageAddress.toField()); - } -} - export class Sender extends EnvironmentGetterInstruction { static type: string = 'SENDER'; static readonly opcode: Opcode = Opcode.SENDER; diff --git a/yarn-project/simulator/src/avm/opcodes/storage.test.ts b/yarn-project/simulator/src/avm/opcodes/storage.test.ts index fd8cc1e484e..d7d1aa88720 100644 --- a/yarn-project/simulator/src/avm/opcodes/storage.test.ts +++ b/yarn-project/simulator/src/avm/opcodes/storage.test.ts @@ -19,7 +19,7 @@ describe('Storage Instructions', () => { persistableState = mock(); context = initContext({ persistableState: persistableState, - env: initExecutionEnvironment({ address, storageAddress: address }), + env: initExecutionEnvironment({ address }), }); }); @@ -52,7 +52,7 @@ describe('Storage Instructions', () => { it('Should not be able to write to storage in a static call', async () => { context = initContext({ persistableState: persistableState, - env: initExecutionEnvironment({ address, storageAddress: address, isStaticCall: true }), + env: initExecutionEnvironment({ address, isStaticCall: true }), }); const a = new Field(1n); diff --git a/yarn-project/simulator/src/avm/opcodes/storage.ts b/yarn-project/simulator/src/avm/opcodes/storage.ts index 731dbaec852..7c1972542bd 100644 --- a/yarn-project/simulator/src/avm/opcodes/storage.ts +++ b/yarn-project/simulator/src/avm/opcodes/storage.ts @@ -42,7 +42,7 @@ export class SStore extends BaseStorageInstruction { const slot = memory.get(slotOffset).toFr(); const value = memory.get(srcOffset).toFr(); - context.persistableState.writeStorage(context.environment.storageAddress, slot, value); + context.persistableState.writeStorage(context.environment.address, slot, value); memory.assert(memoryOperations); context.machineState.incrementPc(); @@ -66,7 +66,7 @@ export class SLoad extends BaseStorageInstruction { memory.checkTag(TypeTag.FIELD, slotOffset); const slot = memory.get(slotOffset).toFr(); - const value = await context.persistableState.readStorage(context.environment.storageAddress, slot); + const value = await context.persistableState.readStorage(context.environment.address, slot); memory.set(dstOffset, new Field(value)); context.machineState.incrementPc(); diff --git a/yarn-project/simulator/src/avm/serialization/bytecode_serialization.ts b/yarn-project/simulator/src/avm/serialization/bytecode_serialization.ts index 801f673eeb0..feefd541cde 100644 --- a/yarn-project/simulator/src/avm/serialization/bytecode_serialization.ts +++ b/yarn-project/simulator/src/avm/serialization/bytecode_serialization.ts @@ -47,7 +47,6 @@ import { Shl, Shr, StaticCall, - StorageAddress, Sub, Timestamp, ToRadixLE, @@ -85,7 +84,6 @@ const INSTRUCTION_SET = () => [Shr.opcode, Shr], [Cast.opcode, Cast], [Address.opcode, Address], - [StorageAddress.opcode, StorageAddress], [Sender.opcode, Sender], [FunctionSelector.opcode, FunctionSelector], [TransactionFee.opcode, TransactionFee], diff --git a/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts b/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts index 549d490c4de..cd2183a0007 100644 --- a/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts +++ b/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts @@ -25,7 +25,6 @@ export enum Opcode { CAST, // Execution environment ADDRESS, - STORAGEADDRESS, SENDER, FUNCTIONSELECTOR, TRANSACTIONFEE, diff --git a/yarn-project/simulator/src/public/executor.ts b/yarn-project/simulator/src/public/executor.ts index 5b579d2139f..846b1e4bab9 100644 --- a/yarn-project/simulator/src/public/executor.ts +++ b/yarn-project/simulator/src/public/executor.ts @@ -134,7 +134,6 @@ function createAvmExecutionEnvironment( ): AvmExecutionEnvironment { return new AvmExecutionEnvironment( executionRequest.contractAddress, - executionRequest.callContext.storageContractAddress, executionRequest.callContext.msgSender, executionRequest.callContext.functionSelector, /*contractCallDepth=*/ Fr.zero(), diff --git a/yarn-project/simulator/src/public/side_effect_trace.test.ts b/yarn-project/simulator/src/public/side_effect_trace.test.ts index 63224eafddf..16dd8afd6da 100644 --- a/yarn-project/simulator/src/public/side_effect_trace.test.ts +++ b/yarn-project/simulator/src/public/side_effect_trace.test.ts @@ -99,7 +99,7 @@ describe('Side Effect Trace', () => { const pxResult = toPxResult(trace); expect(pxResult.noteHashReadRequests).toEqual([ { - //storageAddress: contractAddress, + //address: contractAddress, value: utxo, //exists: exists, counter: startCounter, @@ -116,7 +116,7 @@ describe('Side Effect Trace', () => { const pxResult = toPxResult(trace); expect(pxResult.noteHashes).toEqual([ { - //storageAddress: contractAddress, + //address: contractAddress, value: utxo, counter: startCounter, }, diff --git a/yarn-project/simulator/src/public/side_effect_trace.ts b/yarn-project/simulator/src/public/side_effect_trace.ts index fbed487d033..53bdaf25287 100644 --- a/yarn-project/simulator/src/public/side_effect_trace.ts +++ b/yarn-project/simulator/src/public/side_effect_trace.ts @@ -80,12 +80,12 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface { this.sideEffectCounter++; } - public tracePublicStorageRead(storageAddress: Fr, slot: Fr, value: Fr, _exists: boolean, _cached: boolean) { + public tracePublicStorageRead(address: Fr, slot: Fr, value: Fr, _exists: boolean, _cached: boolean) { // TODO(4805): check if some threshold is reached for max storage reads // (need access to parent length, or trace needs to be initialized with parent's contents) // NOTE: exists and cached are unused for now but may be used for optimizations or kernel hints later this.contractStorageReads.push( - new ContractStorageRead(slot, value, this.sideEffectCounter, AztecAddress.fromField(storageAddress)), + new ContractStorageRead(slot, value, this.sideEffectCounter, AztecAddress.fromField(address)), ); this.avmCircuitHints.storageValues.items.push( new AvmKeyValueHint(/*key=*/ new Fr(this.sideEffectCounter), /*value=*/ value), @@ -94,19 +94,19 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface { this.incrementSideEffectCounter(); } - public tracePublicStorageWrite(storageAddress: Fr, slot: Fr, value: Fr) { + public tracePublicStorageWrite(address: Fr, slot: Fr, value: Fr) { // TODO(4805): check if some threshold is reached for max storage writes // (need access to parent length, or trace needs to be initialized with parent's contents) this.contractStorageUpdateRequests.push( - new ContractStorageUpdateRequest(slot, value, this.sideEffectCounter, storageAddress), + new ContractStorageUpdateRequest(slot, value, this.sideEffectCounter, address), ); this.logger.debug(`SSTORE cnt: ${this.sideEffectCounter} val: ${value} slot: ${slot}`); this.incrementSideEffectCounter(); } - public traceNoteHashCheck(_storageAddress: Fr, noteHash: Fr, _leafIndex: Fr, exists: boolean) { + public traceNoteHashCheck(_address: Fr, noteHash: Fr, _leafIndex: Fr, exists: boolean) { // TODO(4805): check if some threshold is reached for max note hash checks - // NOTE: storageAddress is unused but will be important when an AVM circuit processes an entire enqueued call + // NOTE: address is unused but will be important when an AVM circuit processes an entire enqueued call // TODO(dbanks12): leafIndex is unused for now but later must be used by kernel to constrain that the kernel // is in fact checking the leaf indicated by the user this.noteHashReadRequests.push(new ReadRequest(noteHash, this.sideEffectCounter)); @@ -117,9 +117,9 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface { this.incrementSideEffectCounter(); } - public traceNewNoteHash(_storageAddress: Fr, noteHash: Fr) { + public traceNewNoteHash(_address: Fr, noteHash: Fr) { // TODO(4805): check if some threshold is reached for max new note hash - // NOTE: storageAddress is unused but will be important when an AVM circuit processes an entire enqueued call + // NOTE: address is unused but will be important when an AVM circuit processes an entire enqueued call // TODO(dbanks12): non-existent note hashes should emit a read request of the note hash that actually // IS there, and the AVM circuit should accept THAT noteHash as a hint. The circuit will then compare // the noteHash against the one provided by the user code to determine what to return to the user (exists or not), @@ -129,9 +129,9 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface { this.incrementSideEffectCounter(); } - public traceNullifierCheck(_storageAddress: Fr, nullifier: Fr, _leafIndex: Fr, exists: boolean, _isPending: boolean) { + public traceNullifierCheck(_address: Fr, nullifier: Fr, _leafIndex: Fr, exists: boolean, _isPending: boolean) { // TODO(4805): check if some threshold is reached for max new nullifier - // NOTE: storageAddress is unused but will be important when an AVM circuit processes an entire enqueued call + // NOTE: address is unused but will be important when an AVM circuit processes an entire enqueued call // NOTE: isPending and leafIndex are unused for now but may be used for optimizations or kernel hints later const readRequest = new ReadRequest(nullifier, this.sideEffectCounter); if (exists) { @@ -146,9 +146,9 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface { this.incrementSideEffectCounter(); } - public traceNewNullifier(_storageAddress: Fr, nullifier: Fr) { + public traceNewNullifier(_address: Fr, nullifier: Fr) { // TODO(4805): check if some threshold is reached for max new nullifier - // NOTE: storageAddress is unused but will be important when an AVM circuit processes an entire enqueued call + // NOTE: address is unused but will be important when an AVM circuit processes an entire enqueued call this.nullifiers.push(new Nullifier(nullifier, this.sideEffectCounter, /*noteHash=*/ Fr.ZERO)); this.logger.debug(`NEW_NULLIFIER cnt: ${this.sideEffectCounter}`); this.incrementSideEffectCounter(); @@ -327,7 +327,7 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface { function createPublicExecutionRequest(avmEnvironment: AvmExecutionEnvironment): PublicExecutionRequest { const callContext = CallContext.from({ msgSender: avmEnvironment.sender, - storageContractAddress: avmEnvironment.storageAddress, + storageContractAddress: avmEnvironment.address, functionSelector: avmEnvironment.functionSelector, isDelegateCall: false, isStaticCall: avmEnvironment.isStaticCall, diff --git a/yarn-project/simulator/src/public/side_effect_trace_interface.ts b/yarn-project/simulator/src/public/side_effect_trace_interface.ts index 91326fb021b..2196620ae8e 100644 --- a/yarn-project/simulator/src/public/side_effect_trace_interface.ts +++ b/yarn-project/simulator/src/public/side_effect_trace_interface.ts @@ -8,12 +8,12 @@ import { type TracedContractInstance } from './side_effect_trace.js'; export interface PublicSideEffectTraceInterface { fork(): PublicSideEffectTraceInterface; getCounter(): number; - tracePublicStorageRead(storageAddress: Fr, slot: Fr, value: Fr, exists: boolean, cached: boolean): void; - tracePublicStorageWrite(storageAddress: Fr, slot: Fr, value: Fr): void; - traceNoteHashCheck(storageAddress: Fr, noteHash: Fr, leafIndex: Fr, exists: boolean): void; - traceNewNoteHash(storageAddress: Fr, noteHash: Fr): void; - traceNullifierCheck(storageAddress: Fr, nullifier: Fr, leafIndex: Fr, exists: boolean, isPending: boolean): void; - traceNewNullifier(storageAddress: Fr, nullifier: Fr): void; + tracePublicStorageRead(address: Fr, slot: Fr, value: Fr, exists: boolean, cached: boolean): void; + tracePublicStorageWrite(address: Fr, slot: Fr, value: Fr): void; + traceNoteHashCheck(address: Fr, noteHash: Fr, leafIndex: Fr, exists: boolean): void; + traceNewNoteHash(address: Fr, noteHash: Fr): void; + traceNullifierCheck(address: Fr, nullifier: Fr, leafIndex: Fr, exists: boolean, isPending: boolean): void; + traceNewNullifier(address: Fr, nullifier: Fr): void; traceL1ToL2MessageCheck(contractAddress: Fr, msgHash: Fr, msgLeafIndex: Fr, exists: boolean): void; // TODO(dbanks12): should new message accept contract address as arg? traceNewL2ToL1Message(recipient: Fr, content: Fr): void; From 0e6311ac108927476569471b688eba7c17c8f37d Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Thu, 5 Sep 2024 00:57:51 +0000 Subject: [PATCH 3/3] noir fmt --- noir-projects/aztec-nr/authwit/src/entrypoint/app.nr | 2 +- noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr | 2 +- .../aztec-nr/aztec/src/context/call_interfaces.nr | 12 ++++++------ .../aztec-nr/aztec/src/context/private_context.nr | 12 ++++++------ .../aztec/src/oracle/enqueue_public_function_call.nr | 12 ++++++------ 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr b/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr index b1828eacfbd..d7ede3e562c 100644 --- a/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr +++ b/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr @@ -65,7 +65,7 @@ impl AppPayload { call.target_address, call.function_selector, call.args_hash, - call.is_static, + call.is_static ); } else { let _result = context.call_private_function_with_packed_args( diff --git a/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr b/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr index 9e17a102935..cd1ce17c66d 100644 --- a/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr +++ b/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr @@ -64,7 +64,7 @@ impl FeePayload { call.target_address, call.function_selector, call.args_hash, - call.is_static, + call.is_static ); } else { let _result = context.call_private_function_with_packed_args( diff --git a/noir-projects/aztec-nr/aztec/src/context/call_interfaces.nr b/noir-projects/aztec-nr/aztec/src/context/call_interfaces.nr index 87bcfaad745..70853c48a45 100644 --- a/noir-projects/aztec-nr/aztec/src/context/call_interfaces.nr +++ b/noir-projects/aztec-nr/aztec/src/context/call_interfaces.nr @@ -203,7 +203,7 @@ impl PublicCallInterface { self.target_contract, self.selector, args_hash, - /*static=*/ false, + /*static=*/ false ) } @@ -214,7 +214,7 @@ impl PublicCallInterface { self.target_contract, self.selector, args_hash, - /*static=*/ true, + /*static=*/ true ) } } @@ -258,7 +258,7 @@ impl PublicVoidCallInterface { self.target_contract, self.selector, args_hash, - /*static=*/ false, + /*static=*/ false ) } @@ -269,7 +269,7 @@ impl PublicVoidCallInterface { self.target_contract, self.selector, args_hash, - /*static=*/ true, + /*static=*/ true ) } } @@ -309,7 +309,7 @@ impl PublicStaticCallInterface { self.target_contract, self.selector, args_hash, - /*static=*/ true, + /*static=*/ true ) } } @@ -348,7 +348,7 @@ impl PublicStaticVoidCallInterface { self.target_contract, self.selector, args_hash, - /*static=*/ true, + /*static=*/ true ) } } diff --git a/noir-projects/aztec-nr/aztec/src/context/private_context.nr b/noir-projects/aztec-nr/aztec/src/context/private_context.nr index d00b54202e2..81144280748 100644 --- a/noir-projects/aztec-nr/aztec/src/context/private_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/private_context.nr @@ -445,7 +445,7 @@ impl PrivateContext { contract_address: AztecAddress, function_selector: FunctionSelector, args_hash: Field, - is_static_call: bool, + is_static_call: bool ) { let counter = self.next_counter(); @@ -455,14 +455,14 @@ impl PrivateContext { function_selector, args_hash, counter, - is_static_call, + is_static_call ); let call_context = self.generate_call_context( contract_address, function_selector, is_static_call, - /*is_delegate_call=*/ false, + /*is_delegate_call=*/ false ); let item = PublicCallStackItemCompressed { @@ -495,7 +495,7 @@ impl PrivateContext { contract_address: AztecAddress, function_selector: FunctionSelector, args_hash: Field, - is_static_call: bool, + is_static_call: bool ) { let counter = self.next_counter(); @@ -505,14 +505,14 @@ impl PrivateContext { function_selector, args_hash, counter, - is_static_call, + is_static_call ); let call_context = self.generate_call_context( contract_address, function_selector, is_static_call, - /*is_delegate_call=*/ false, + /*is_delegate_call=*/ false ); let item = PublicCallStackItemCompressed { diff --git a/noir-projects/aztec-nr/aztec/src/oracle/enqueue_public_function_call.nr b/noir-projects/aztec-nr/aztec/src/oracle/enqueue_public_function_call.nr index a8b6602c94a..7c03e9691ba 100644 --- a/noir-projects/aztec-nr/aztec/src/oracle/enqueue_public_function_call.nr +++ b/noir-projects/aztec-nr/aztec/src/oracle/enqueue_public_function_call.nr @@ -6,7 +6,7 @@ unconstrained fn enqueue_public_function_call_oracle( _function_selector: FunctionSelector, _args_hash: Field, _side_effect_counter: u32, - _is_static_call: bool, + _is_static_call: bool ) {} unconstrained pub fn enqueue_public_function_call_internal( @@ -14,14 +14,14 @@ unconstrained pub fn enqueue_public_function_call_internal( function_selector: FunctionSelector, args_hash: Field, side_effect_counter: u32, - is_static_call: bool, + is_static_call: bool ) { enqueue_public_function_call_oracle( contract_address, function_selector, args_hash, side_effect_counter, - is_static_call, + is_static_call ); } @@ -31,7 +31,7 @@ unconstrained fn set_public_teardown_function_call_oracle( _function_selector: FunctionSelector, _args_hash: Field, _side_effect_counter: u32, - _is_static_call: bool, + _is_static_call: bool ) {} unconstrained pub fn set_public_teardown_function_call_internal( @@ -39,14 +39,14 @@ unconstrained pub fn set_public_teardown_function_call_internal( function_selector: FunctionSelector, args_hash: Field, side_effect_counter: u32, - is_static_call: bool, + is_static_call: bool ) { set_public_teardown_function_call_oracle( contract_address, function_selector, args_hash, side_effect_counter, - is_static_call, + is_static_call ); }