diff --git a/barretenberg/cpp/pil/avm/constants_gen.pil b/barretenberg/cpp/pil/avm/constants_gen.pil index adf6902b83c..a1f4cb2c1a5 100644 --- a/barretenberg/cpp/pil/avm/constants_gen.pil +++ b/barretenberg/cpp/pil/avm/constants_gen.pil @@ -1,9 +1,9 @@ // GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants in circuits.js namespace constants(256); - pol MAX_NEW_NOTE_HASHES_PER_CALL = 16; - pol MAX_NEW_NULLIFIERS_PER_CALL = 16; + pol MAX_NOTE_HASHES_PER_CALL = 16; + pol MAX_NULLIFIERS_PER_CALL = 16; pol MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL = 16; - pol MAX_NEW_L2_TO_L1_MSGS_PER_CALL = 2; + pol MAX_L2_TO_L1_MSGS_PER_CALL = 2; pol MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL = 32; pol MAX_PUBLIC_DATA_READS_PER_CALL = 32; pol MAX_NOTE_HASH_READ_REQUESTS_PER_CALL = 16; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp index 4315d4cdb8e..ea7905c1210 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp @@ -218,7 +218,7 @@ VmPublicInputs Execution::convert_public_inputs(std::vector const& public_in ko_side_effect[dest_offset] = public_inputs_vec[pcpi_offset + 2]; } // For EMITNOTEHASH - for (size_t i = 0; i < MAX_NEW_NOTE_HASHES_PER_CALL; i++) { + for (size_t i = 0; i < MAX_NOTE_HASHES_PER_CALL; i++) { size_t dest_offset = START_EMIT_NOTE_HASH_WRITE_OFFSET + i; size_t pcpi_offset = PCPI_NEW_NOTE_HASHES_OFFSET + (i * NOTE_HASH_LENGTH); @@ -226,7 +226,7 @@ VmPublicInputs Execution::convert_public_inputs(std::vector const& public_in ko_side_effect[dest_offset] = public_inputs_vec[pcpi_offset + 1]; } // For EMITNULLIFIER - for (size_t i = 0; i < MAX_NEW_NULLIFIERS_PER_CALL; i++) { + for (size_t i = 0; i < MAX_NULLIFIERS_PER_CALL; i++) { size_t dest_offset = START_EMIT_NULLIFIER_WRITE_OFFSET + i; size_t pcpi_offset = PCPI_NEW_NULLIFIERS_OFFSET + (i * NULLIFIER_LENGTH); @@ -234,7 +234,7 @@ VmPublicInputs Execution::convert_public_inputs(std::vector const& public_in ko_side_effect[dest_offset] = public_inputs_vec[pcpi_offset + 1]; } // For EMITL2TOL1MSG - for (size_t i = 0; i < MAX_NEW_L2_TO_L1_MSGS_PER_CALL; i++) { + for (size_t i = 0; i < MAX_L2_TO_L1_MSGS_PER_CALL; i++) { size_t dest_offset = START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET + i; size_t pcpi_offset = PCPI_NEW_L2_TO_L1_MSGS_OFFSET + (i * L2_TO_L1_MESSAGE_LENGTH); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/aztec_constants.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/aztec_constants.hpp index abf69ae1c0b..8ad866f7f54 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/aztec_constants.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/aztec_constants.hpp @@ -1,10 +1,10 @@ // GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants in circuits.js #pragma once -#define MAX_NEW_NOTE_HASHES_PER_CALL 16 -#define MAX_NEW_NULLIFIERS_PER_CALL 16 +#define MAX_NOTE_HASHES_PER_CALL 16 +#define MAX_NULLIFIERS_PER_CALL 16 #define MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL 16 -#define MAX_NEW_L2_TO_L1_MSGS_PER_CALL 2 +#define MAX_L2_TO_L1_MSGS_PER_CALL 2 #define MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL 32 #define MAX_PUBLIC_DATA_READS_PER_CALL 32 #define MAX_NOTE_HASH_READ_REQUESTS_PER_CALL 16 diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/constants.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/constants.hpp index 86c18af9fd9..62d2cbc4945 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/constants.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/constants.hpp @@ -13,8 +13,8 @@ inline const std::size_t KERNEL_INPUTS_LENGTH = PUBLIC_CONTEXT_INPUTS_LENGTH; inline const std::size_t KERNEL_OUTPUTS_LENGTH = MAX_NOTE_HASH_READ_REQUESTS_PER_CALL + MAX_NULLIFIER_READ_REQUESTS_PER_CALL + MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL + MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL + - MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL + MAX_PUBLIC_DATA_READS_PER_CALL + MAX_NEW_NOTE_HASHES_PER_CALL + - MAX_NEW_NULLIFIERS_PER_CALL + MAX_NEW_L2_TO_L1_MSGS_PER_CALL + MAX_UNENCRYPTED_LOGS_PER_CALL; + MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL + MAX_PUBLIC_DATA_READS_PER_CALL + MAX_NOTE_HASHES_PER_CALL + + MAX_NULLIFIERS_PER_CALL + MAX_L2_TO_L1_MSGS_PER_CALL + MAX_UNENCRYPTED_LOGS_PER_CALL; // START INDEXES in the PUBLIC_CIRCUIT_PUBLIC_INPUTS // These line up with indexes found in @@ -63,14 +63,14 @@ inline const uint32_t PCPI_NEW_NOTE_HASHES_OFFSET = PCPI_PUBLIC_CALLSTACK_OFFSET + MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL; inline const uint32_t PCPI_NEW_NULLIFIERS_OFFSET = - PCPI_NEW_NOTE_HASHES_OFFSET + (MAX_NEW_NOTE_HASHES_PER_CALL * NOTE_HASH_LENGTH); + PCPI_NEW_NOTE_HASHES_OFFSET + (MAX_NOTE_HASHES_PER_CALL * NOTE_HASH_LENGTH); // TODO(md): Note legnth of nullifier is 3? - it includes the note it is nullifying too inline const uint32_t PCPI_NEW_L2_TO_L1_MSGS_OFFSET = - PCPI_NEW_NULLIFIERS_OFFSET + (MAX_NEW_NULLIFIERS_PER_CALL * NULLIFIER_LENGTH); + PCPI_NEW_NULLIFIERS_OFFSET + (MAX_NULLIFIERS_PER_CALL * NULLIFIER_LENGTH); inline const uint32_t PCPI_START_SIDE_EFFECT_COUNTER_OFFSET = - PCPI_NEW_L2_TO_L1_MSGS_OFFSET + (MAX_NEW_L2_TO_L1_MSGS_PER_CALL * L2_TO_L1_MESSAGE_LENGTH); + PCPI_NEW_L2_TO_L1_MSGS_OFFSET + (MAX_L2_TO_L1_MSGS_PER_CALL * L2_TO_L1_MESSAGE_LENGTH); inline const uint32_t PCPI_NEW_UNENCRYPTED_LOGS_OFFSET = PCPI_START_SIDE_EFFECT_COUNTER_OFFSET + /*1 item gap*/ 1; diff --git a/docs/docs/guides/smart_contracts/writing_contracts/storage/storage_slots.md b/docs/docs/guides/smart_contracts/writing_contracts/storage/storage_slots.md index a21af4811c8..6c40b6a681b 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/storage/storage_slots.md +++ b/docs/docs/guides/smart_contracts/writing_contracts/storage/storage_slots.md @@ -35,7 +35,7 @@ sequenceDiagram TokenNote->>Utils: note_hash = H(amount, to, randomness) Utils->>NoteHash: compute_inner_hash(derived_slot, note_hash) NoteHash->>LifeCycle: inner_note_hash = H(derived_slot, note_hash) - LifeCycle->>Context: push_new_note_hash(inner_note_hash) + LifeCycle->>Context: push_note_hash(inner_note_hash) end Context->>Kernel: siloed_note_hash = H(contract_address, inner_note_hash) ``` diff --git a/docs/docs/protocol-specs/circuits/private-function.md b/docs/docs/protocol-specs/circuits/private-function.md index d137504d227..3beae7c57b4 100644 --- a/docs/docs/protocol-specs/circuits/private-function.md +++ b/docs/docs/protocol-specs/circuits/private-function.md @@ -43,9 +43,9 @@ The public inputs of _every_ private function _must_ adhere to the following ABI | `call_context` | [`CallContext`](#callcontext) | Context of the call corresponding to this function execution. | | `args_hash` | `field` | Hash of the function arguments. | | `return_values` | [`field`; [`RETURN_VALUES_LENGTH`](../constants.md#circuit-constants)] | Return values of this function call. | -| `note_hashes` | [[`NoteHash`](#notehash); [`MAX_NEW_NOTE_HASHES_PER_CALL`](../constants.md#circuit-constants)] | New note hashes created in this function call. | -| `nullifiers` | [[`Nullifier`](#nullifier); [`MAX_NEW_NULLIFIERS_PER_CALL`](../constants.md#circuit-constants)] | New nullifiers created in this function call. | -| `l2_to_l1_messages` | [[`L2toL1Message`](#l2tol1message); [`MAX_NEW_L2_TO_L1_MSGS_PER_CALL`](../constants.md#circuit-constants)] | New L2 to L1 messages created in this function call. | +| `note_hashes` | [[`NoteHash`](#notehash); [`MAX_NOTE_HASHES_PER_CALL`](../constants.md#circuit-constants)] | New note hashes created in this function call. | +| `nullifiers` | [[`Nullifier`](#nullifier); [`MAX_NULLIFIERS_PER_CALL`](../constants.md#circuit-constants)] | New nullifiers created in this function call. | +| `l2_to_l1_messages` | [[`L2toL1Message`](#l2tol1message); [`MAX_L2_TO_L1_MSGS_PER_CALL`](../constants.md#circuit-constants)] | New L2 to L1 messages created in this function call. | | `unencrypted_log_hashes` | [[`UnencryptedLogHash`](#unencryptedloghash); [`MAX_UNENCRYPTED_LOG_HASHES_PER_CALL`](../constants.md#circuit-constants)] | Hashes of the unencrypted logs emitted in this function call. | | `encrypted_log_hashes` | [[`EncryptedLogHash`](#encryptedloghash); [`MAX_ENCRYPTED_LOG_HASHES_PER_CALL`](../constants.md#circuit-constants)] | Hashes of the encrypted logs emitted in this function call. | | `encrypted_note_preimage_hashes` | [[`EncryptedNotePreimageHash`](#encryptednotepreimagehash); [`MAX_ENCRYPTED_NOTE_PREIMAGE_HASHES_PER_CALL`](../constants.md#circuit-constants)] | Hashes of the encrypted note preimages emitted in this function call. | diff --git a/docs/docs/protocol-specs/circuits/private-kernel-initial.mdx b/docs/docs/protocol-specs/circuits/private-kernel-initial.mdx index a7e2fde94a5..74919b877b3 100644 --- a/docs/docs/protocol-specs/circuits/private-kernel-initial.mdx +++ b/docs/docs/protocol-specs/circuits/private-kernel-initial.mdx @@ -737,8 +737,8 @@ Data that holds details about the current private function call. | Field | Type | Description | | ----------------------------- | --------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| `note_hash_range_hints` | [`field`, [`MAX_NEW_NOTE_HASHES_PER_CALL`](../constants.md#circuit-constants)] | Indices of the next emitted private call requests for note hashes. | -| `nullifier_range_hints` | [`field`, [`MAX_NEW_NULLIFIERS_PER_CALL`](../constants.md#circuit-constants)] | Indices of the next emitted private call requests for nullifiers. | +| `note_hash_range_hints` | [`field`, [`MAX_NOTE_HASHES_PER_CALL`](../constants.md#circuit-constants)] | Indices of the next emitted private call requests for note hashes. | +| `nullifier_range_hints` | [`field`, [`MAX_NULLIFIERS_PER_CALL`](../constants.md#circuit-constants)] | Indices of the next emitted private call requests for nullifiers. | | `unencrypted_log_range_hints` | [`field`, [`MAX_UNENCRYPTED_LOG_HASHES_PER_CALL`](../constants.md#circuit-constants)] | Indices of the next emitted private call requests for unencrypted logs. | | `encrypted_log_range_hints` | [`field`, [`MAX_ENCRYPTED_LOG_HASHES_PER_CALL`](../constants.md#circuit-constants)] | Indices of the next emitted private call requests for encrypted logs. | | `encrypted_note_range_hints` | [`field`, [`MAX_ENCRYPTED_NOTE_PREIMAGE_HASHES_PER_CALL`](../constants.md#circuit-constants)] | Indices of the next emitted private call requests for encrypted notes. | @@ -768,9 +768,9 @@ Would it be accurate to describe this as `AccumulatedTransientSideEffects`, perh | Field | Type | Description | | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -| `note_hash_contexts` | [[`NoteHashContext`](#notehashcontext); [`MAX_NEW_NOTE_HASHES_PER_TX`](../constants.md#circuit-constants)] | Note hashes with extra data aiding verification. | -| `nullifier_contexts` | [[`NullifierContext`](#nullifiercontext); [`MAX_NEW_NULLIFIERS_PER_TX`](../constants.md#circuit-constants)] | Nullifiers with extra data aiding verification. | -| `l2_to_l1_message_contexts` | [[`L2toL1MessageContext`](#l2tol1messagecontext); [`MAX_NEW_L2_TO_L1_MSGS_PER_TX`](../constants.md#circuit-constants)] | L2-to-l1 messages with extra data aiding verification. | +| `note_hash_contexts` | [[`NoteHashContext`](#notehashcontext); [`MAX_NOTE_HASHES_PER_TX`](../constants.md#circuit-constants)] | Note hashes with extra data aiding verification. | +| `nullifier_contexts` | [[`NullifierContext`](#nullifiercontext); [`MAX_NULLIFIERS_PER_TX`](../constants.md#circuit-constants)] | Nullifiers with extra data aiding verification. | +| `l2_to_l1_message_contexts` | [[`L2toL1MessageContext`](#l2tol1messagecontext); [`MAX_L2_TO_L1_MSGS_PER_TX`](../constants.md#circuit-constants)] | L2-to-l1 messages with extra data aiding verification. | | `unencrypted_log_hash_contexts` | [[`UnencryptedLogHashContext`](#unencryptedloghashcontext); [`MAX_UNENCRYPTED_LOG_HASHES_PER_TX`](../constants.md#circuit-constants)] | Hashes of the unencrypted logs with extra data aiding verification. | | `encrypted_log_hash_contexts` | [[`EncryptedLogHashContext`](#encryptedloghashcontext); [`MAX_ENCRYPTED_LOG_HASHES_PER_TX`](../constants.md#circuit-constants)] | Hashes of the encrypted logs with extra data aiding verification. | | `encrypted_note_preimage_hash_contexts` | [[`EncryptedNotePreimageHashContext`](#encryptednotepreimagehash); [`MAX_ENCRYPTED_NOTE_PREIMAGE_HASHES_PER_TX`](../constants.md#circuit-constants)] | Hashes of the encrypted note preimages with extra data aiding verification. | diff --git a/docs/docs/protocol-specs/circuits/private-kernel-reset.md b/docs/docs/protocol-specs/circuits/private-kernel-reset.md index 01b374e88b9..0b06176d7d9 100644 --- a/docs/docs/protocol-specs/circuits/private-kernel-reset.md +++ b/docs/docs/protocol-specs/circuits/private-kernel-reset.md @@ -243,10 +243,10 @@ The format aligns with the [`PreviousKernel`](./private-kernel-inner#previousker | Field | Type | Description | | ------------------------------------------ | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -| `transient_nullifier_indices` | [`field`; [`MAX_NEW_NOTE_HASHES_PER_TX`](../constants.md#circuit-constants)] | Indices of the nullifiers for transient notes. | -| `nullifier_index_hints` | [`field`; [`MAX_NEW_NULLIFIERS_PER_TX`](../constants.md#circuit-constants)] | Indices of the `transient_nullifier_indices` for transient nullifiers. | +| `transient_nullifier_indices` | [`field`; [`MAX_NOTE_HASHES_PER_TX`](../constants.md#circuit-constants)] | Indices of the nullifiers for transient notes. | +| `nullifier_index_hints` | [`field`; [`MAX_NULLIFIERS_PER_TX`](../constants.md#circuit-constants)] | Indices of the `transient_nullifier_indices` for transient nullifiers. | | `encrypted_note_preimage_hash_index_hints` | [`field`; [`MAX_ENCRYPTED_NOTE_PREIMAGE_HASHES_PER_TX`](../constants.md#circuit-constants)] | Indices of the `encrypted_note_preimage_hash_contexts` for transient preimage hashes. | -| `log_note_hash_hints` | [`field`; [`MAX_NEW_NOTE_HASHES_PER_TX`](../constants.md#circuit-constants)] | Indices of the `note_hash_contexts` for transient preimage hashes. | +| `log_note_hash_hints` | [`field`; [`MAX_NOTE_HASHES_PER_TX`](../constants.md#circuit-constants)] | Indices of the `note_hash_contexts` for transient preimage hashes. | ## `PublicInputs` diff --git a/docs/docs/protocol-specs/circuits/private-kernel-tail.md b/docs/docs/protocol-specs/circuits/private-kernel-tail.md index dc842b8994a..67450a5b281 100644 --- a/docs/docs/protocol-specs/circuits/private-kernel-tail.md +++ b/docs/docs/protocol-specs/circuits/private-kernel-tail.md @@ -227,8 +227,8 @@ Data that aids in the verifications carried out in this circuit: | Field | Type | Description | | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | -| `note_hash_hints` | [[`OrderHint`](#orderhint); [`MAX_NEW_NOTE_HASHES_PER_TX`](../constants.md#circuit-constants)] | Hints for ordering `note_hash_contexts`. | -| `nullifier_hints` | [[`OrderHint`](#orderhint); [`MAX_NEW_NULLIFIERS_PER_TX`](../constants.md#circuit-constants)] | Hints for ordering `nullifier_contexts`. | +| `note_hash_hints` | [[`OrderHint`](#orderhint); [`MAX_NOTE_HASHES_PER_TX`](../constants.md#circuit-constants)] | Hints for ordering `note_hash_contexts`. | +| `nullifier_hints` | [[`OrderHint`](#orderhint); [`MAX_NULLIFIERS_PER_TX`](../constants.md#circuit-constants)] | Hints for ordering `nullifier_contexts`. | | `public_call_request_hints` | [`field`; [`MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX`](../constants.md#circuit-constants)] | Indices of ordered `public_call_request_contexts`. | | `unencrypted_log_hash_hints` | [[`OrderHint`](#orderhint); [`MAX_UNENCRYPTED_LOG_HASHES_PER_TX`](../constants.md#circuit-constants)] | Hints for ordering `unencrypted_log_hash_contexts`. | | `ordered_unencrypted_log_hashes_revertible` | [`field`; [`MAX_UNENCRYPTED_LOG_HASHES_PER_TX`](../constants.md#circuit-constants)] | Ordered revertible `unencrypted_log_hashes`. | diff --git a/docs/docs/protocol-specs/constants.md b/docs/docs/protocol-specs/constants.md index cc41abb0048..1ca57a88515 100644 --- a/docs/docs/protocol-specs/constants.md +++ b/docs/docs/protocol-specs/constants.md @@ -42,9 +42,9 @@ The statically-sized nature the kernel & rollup circuits will restrict the quant | Name | Value | Description | |---|---|---| | `RETURN_VALUES_LENGTH` | 4 | -| `MAX_NEW_NOTE_HASHES_PER_CALL` | 128 | -| `MAX_NEW_NULLIFIERS_PER_CALL` | 128 | -| `MAX_NEW_L2_TO_L1_MSGS_PER_CALL` | 4 | +| `MAX_NOTE_HASHES_PER_CALL` | 128 | +| `MAX_NULLIFIERS_PER_CALL` | 128 | +| `MAX_L2_TO_L1_MSGS_PER_CALL` | 4 | | `MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL` | 128 | | `MAX_PUBLIC_DATA_READS_PER_CALL` | 128 | | `MAX_UNENCRYPTED_LOG_HASHES_PER_CALL` | 128 | @@ -61,9 +61,9 @@ The statically-sized nature the kernel & rollup circuits will restrict the quant | Name | Value | Description | |---|---|---| -| `MAX_NEW_NOTE_HASHES_PER_TX` | 128 | -| `MAX_NEW_NULLIFIERS_PER_TX` | 128 | -| `MAX_NEW_L2_TO_L1_MSGS_PER_TX` | 16 | +| `MAX_NOTE_HASHES_PER_TX` | 128 | +| `MAX_NULLIFIERS_PER_TX` | 128 | +| `MAX_L2_TO_L1_MSGS_PER_TX` | 16 | | `MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX` | 31 | | `MAX_PUBLIC_DATA_READS_PER_TX` | 16 | | `MAX_UNENCRYPTED_LOG_HASHES_PER_TX` | 128 | diff --git a/docs/docs/protocol-specs/data-publication-and-availability/published-data.md b/docs/docs/protocol-specs/data-publication-and-availability/published-data.md index c50f8adba29..9a72572e1b0 100644 --- a/docs/docs/protocol-specs/data-publication-and-availability/published-data.md +++ b/docs/docs/protocol-specs/data-publication-and-availability/published-data.md @@ -7,9 +7,9 @@ The "Effects" of a transaction are the collection of state changes and metadata | Field | Type | Description | | -------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | | `revertCode` | `RevertCode` | Indicates the reason for reverting in public application logic. 0 indicates success. | -| `note_hashes` | `Tuple` | The note hashes to be inserted into the note hash tree. | -| `nullifiers` | `Tuple` | The nullifiers to be inserted into the nullifier tree. | -| `l2_to_l2_msgs` | `Tuple` | The L2 to L1 messages to be inserted into the messagebox on L1. | +| `note_hashes` | `Tuple` | The note hashes to be inserted into the note hash tree. | +| `nullifiers` | `Tuple` | The nullifiers to be inserted into the nullifier tree. | +| `l2_to_l2_msgs` | `Tuple` | The L2 to L1 messages to be inserted into the messagebox on L1. | | `public_data_writes` | `Tuple` | Public data writes to be inserted into the public data tree | | `encrypted_logs` | `TxL2Logs` | Buffers containing the emitted encrypted logs. | | `unencrypted_logs` | `TxL2Logs` | Buffers containing the emitted unencrypted logs. | @@ -23,12 +23,12 @@ Each can have several transactions. Thus, an block is presently encoded as: | 0x4 + a \* 0x20 = tx0Start | 0x4 | len(numTxs) (denoted t) | | | | TxEffect 0 | | tx0Start | 0x20 | revertCode | -| tx0Start + 0x20 | 0x1 | len(newNoteHashes) (denoted b) | -| tx0Start + 0x20 + 0x1 | b \* 0x20 | newNoteHashes | -| tx0Start + 0x20 + 0x1 + b \* 0x20 | 0x1 | len(newNullifiers) (denoted c) | -| tx0Start + 0x20 + 0x1 + b \* 0x20 + 0x1 | c \* 0x20 | newNullifiers | -| tx0Start + 0x20 + 0x1 + b \* 0x20 + 0x1 + c \* 0x20 | 0x1 | len(newL2ToL1Msgs) (denoted d) | -| tx0Start + 0x20 + 0x1 + b \* 0x20 + 0x1 + c \* 0x20 + 0x1 | d \* 0x20 | newL2ToL1Msgs | +| tx0Start + 0x20 | 0x1 | len(noteHashes) (denoted b) | +| tx0Start + 0x20 + 0x1 | b \* 0x20 | noteHashes | +| tx0Start + 0x20 + 0x1 + b \* 0x20 | 0x1 | len(nullifiers) (denoted c) | +| tx0Start + 0x20 + 0x1 + b \* 0x20 + 0x1 | c \* 0x20 | nullifiers | +| tx0Start + 0x20 + 0x1 + b \* 0x20 + 0x1 + c \* 0x20 | 0x1 | len(l2ToL1Msgs) (denoted d) | +| tx0Start + 0x20 + 0x1 + b \* 0x20 + 0x1 + c \* 0x20 + 0x1 | d \* 0x20 | l2ToL1Msgs | | tx0Start + 0x20 + 0x1 + b \* 0x20 + 0x1 + c \* 0x20 + 0x1 + d \* 0x20 | 0x1 | len(newPublicDataWrites) (denoted e) | | tx0Start + 0x20 + 0x1 + b \* 0x20 + 0x1 + c \* 0x20 + 0x1 + d \* 0x20 + 0x01 | e \* 0x40 | newPublicDataWrites | | tx0Start + 0x20 + 0x1 + b \* 0x20 + 0x1 + c \* 0x20 + 0x1 + d \* 0x20 + 0x01 + e \* 0x40 | 0x04 | byteLen(newEncryptedLogs) (denoted f) | diff --git a/docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md b/docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md index 39c17faab89..3aaa83f7d8d 100644 --- a/docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md +++ b/docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md @@ -59,11 +59,11 @@ PrivateKernelCircuitPublicInputs --> CombinedConstantData class PrivateAccumulatedData { +Field encrypted_log_preimages_length +Field unencrypted_log_preimages_length - +Field[MAX_NEW_L2_TO_L1_MSGS_PER_TX] new_l2_to_l1_msgs + +Field[MAX_L2_TO_L1_MSGS_PER_TX] new_l2_to_l1_msgs +SideEffect[MAX_ENCRYPTED_LOGS_PER_TX] encrypted_logs_hashes +SideEffect[MAX_UNENCRYPTED_LOGS_PER_TX] unencrypted_logs_hashes - +SideEffect[MAX_NEW_NOTE_HASHES_PER_TX] new_note_hashes - +SideEffectLinkedToNoteHash[MAX_NEW_NULLIFIERS_PER_TX] new_nullifiers + +SideEffect[MAX_NOTE_HASHES_PER_TX] new_note_hashes + +SideEffectLinkedToNoteHash[MAX_NULLIFIERS_PER_TX] new_nullifiers +CallRequest[MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX] private_call_stack +CallRequest[MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX] public_call_stack } @@ -312,11 +312,11 @@ class CombinedConstantData { class PublicAccumulatedData { +Field encrypted_log_preimages_length +Field unencrypted_log_preimages_length - +Field[MAX_NEW_L2_TO_L1_MSGS_PER_TX] new_l2_to_l1_msgs + +Field[MAX_L2_TO_L1_MSGS_PER_TX] new_l2_to_l1_msgs +SideEffect[MAX_ENCRYPTED_LOGS_PER_TX] encrypted_logs_hashes +SideEffect[MAX_UNENCRYPTED_LOGS_PER_TX] unencrypted_logs_hashes - +SideEffect[MAX_NEW_NOTE_HASHES_PER_TX] new_note_hashes - +SideEffectLinkedToNoteHash[MAX_NEW_NULLIFIERS_PER_TX] new_nullifiers + +SideEffect[MAX_NOTE_HASHES_PER_TX] new_note_hashes + +SideEffectLinkedToNoteHash[MAX_NULLIFIERS_PER_TX] new_nullifiers +CallRequest[MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX] public_call_stack +PublicDataUpdateRequest[MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX] public_data_update_requests +Gas gas_used @@ -378,9 +378,9 @@ class CombinedAccumulatedData { +Field unencrypted_log_preimages_length +Field encrypted_logs_hash +Field unencrypted_logs_hash - +Field[MAX_NEW_L2_TO_L1_MSGS_PER_TX] new_l2_to_l1_msgs - +Field[MAX_NEW_NOTE_HASHES_PER_TX] new_note_hashes - +Field[MAX_NEW_NULLIFIERS_PER_TX] new_nullifiers + +Field[MAX_L2_TO_L1_MSGS_PER_TX] new_l2_to_l1_msgs + +Field[MAX_NOTE_HASHES_PER_TX] new_note_hashes + +Field[MAX_NULLIFIERS_PER_TX] new_nullifiers +PublicDataUpdateRequest[MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX] public_data_update_requests +Gas gas_used } diff --git a/docs/docs/protocol-specs/l1-smart-contracts/index.md b/docs/docs/protocol-specs/l1-smart-contracts/index.md index c3b2c9e99f5..de32098a4eb 100644 --- a/docs/docs/protocol-specs/l1-smart-contracts/index.md +++ b/docs/docs/protocol-specs/l1-smart-contracts/index.md @@ -34,19 +34,19 @@ def process(block: ProvenBlock, proof: Proof): assert self.outbox.insert( block_number, header.content_commitment.out_hash, - header.content_commitment.tx_tree_height + math.ceil(log2(MAX_NEW_L2_TO_L1_MSGS_PER_TX)) + header.content_commitment.tx_tree_height + math.ceil(log2(MAX_L2_TO_L1_MSGS_PER_TX)) ) self.archive = block.archive emit BlockProcessed(block_number) ``` -:::info Why `math.ceil(log2(MAX_NEW_L2_TO_L1_MSGS_PER_TX))`? +:::info Why `math.ceil(log2(MAX_L2_TO_L1_MSGS_PER_TX))`? The argument to the `insert` function is the `outbox` is the heigh of the message tree. Since every transaction can hold more than 1 message, it might add multiple layers to the tree. -For a binary tree, the number of extra layers to add is computed as `math.ceil(log2(MAX_NEW_L2_TO_L1_MSGS_PER_TX))`. -Currently, `MAX_NEW_L2_TO_L1_MSGS_PER_TX = 2` which means that we are simply adding 1 extra layer. +For a binary tree, the number of extra layers to add is computed as `math.ceil(log2(MAX_L2_TO_L1_MSGS_PER_TX))`. +Currently, `MAX_L2_TO_L1_MSGS_PER_TX = 2` which means that we are simply adding 1 extra layer. ::: @@ -129,7 +129,7 @@ class StateTransitioner: assert self.OUTBOX.insert( block_number, header.content_commitment.out_hash, - header.content_commitment.tx_tree_height + math.ceil(log2(MAX_NEW_L2_TO_L1_MSGS_PER_TX)) + header.content_commitment.tx_tree_height + math.ceil(log2(MAX_L2_TO_L1_MSGS_PER_TX)) ) self.archive = archive emit BlockProcessed(block_number) diff --git a/docs/docs/protocol-specs/public-vm/execution.md b/docs/docs/protocol-specs/public-vm/execution.md index 901929e94fe..ea2fa9e301a 100644 --- a/docs/docs/protocol-specs/public-vm/execution.md +++ b/docs/docs/protocol-specs/public-vm/execution.md @@ -208,9 +208,9 @@ The AVM's exceptional halting conditions area listed below: assert worldStateAccessTrace.publicStorageReads.length <= 1024 AND worldStateAccessTrace.publicStorageWrites.length <= 1024 AND worldStateAccessTrace.noteHashChecks.length <= 1024 - AND worldStateAccessTrace.newNoteHashes.length <= 1024 + AND worldStateAccessTrace.noteHashes.length <= 1024 AND worldStateAccessTrace.nullifierChecks.length <= 1024 - AND worldStateAccessTrace.newNullifiers.length <= 1024 + AND worldStateAccessTrace.nullifiers.length <= 1024 AND worldStateAccessTrace.l1ToL2MessageChecks.length <= 1024 AND worldStateAccessTrace.archiveChecks.length <= 1024 @@ -224,13 +224,13 @@ The AVM's exceptional halting conditions area listed below: assert instructions[machineState.pc].opcode != NOTEHASHEXISTS OR noteHashChecks.length < 1024 assert instructions[machineState.pc].opcode != EMITNOTEHASH - OR newNoteHashes.length < 1024 + OR noteHashes.length < 1024 // Nullifiers assert instructions[machineState.pc].opcode != NULLIFIEREXISTS OR nullifierChecks.length < 1024 assert instructions[machineState.pc].opcode != EMITNULLIFIER - OR newNullifiers.length < 1024 + OR nullifiers.length < 1024 // Read L1 to L2 messages assert instructions[machineState.pc].opcode != L1TOL2MSGEXISTS 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 cf740097fc4..76a1afddf45 100644 --- a/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx +++ b/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx @@ -1398,7 +1398,7 @@ Emit a new note hash to be inserted into the note hash tree - **World State access tracing**: -{`context.worldStateAccessTrace.newNoteHashes.append( +{`context.worldStateAccessTrace.noteHashes.append( TracedNoteHash { callPointer: context.environment.callPointer, noteHash: M[noteHashOffset], // unsiloed note hash @@ -1467,7 +1467,7 @@ Emit a new nullifier to be inserted into the nullifier tree - **World State access tracing**: -{`context.worldStateAccessTrace.newNullifiers.append( +{`context.worldStateAccessTrace.nullifiers.append( TracedNullifier { callPointer: context.environment.callPointer, nullifier: M[nullifierOffset], // unsiloed nullifier diff --git a/docs/docs/protocol-specs/public-vm/state.md b/docs/docs/protocol-specs/public-vm/state.md index bd2498b4218..e81b6299c83 100644 --- a/docs/docs/protocol-specs/public-vm/state.md +++ b/docs/docs/protocol-specs/public-vm/state.md @@ -77,9 +77,9 @@ Each entry in the world state access trace is listed below along with its type a | `publicStorageReads` | Public Storage | `Vector` | [`SLOAD`](./instruction-set#isa-section-sload) | | `publicStorageWrites` | Public Storage | `Vector` | [`SSTORE`](./instruction-set#isa-section-sstore) | | `noteHashChecks` | Note Hashes | `Vector` | [`NOTEHASHEXISTS`](./instruction-set#isa-section-notehashexists) | -| `newNoteHashes` | Note Hashes | `Vector` | [`EMITNOTEHASH`](./instruction-set#isa-section-emitnotehash) | +| `noteHashes` | Note Hashes | `Vector` | [`EMITNOTEHASH`](./instruction-set#isa-section-emitnotehash) | | `nullifierChecks` | Nullifiers | `Vector` | [`NULLIFIERSEXISTS`](./instruction-set#isa-section-nullifierexists) | -| `newNullifiers` | Nullifiers | `Vector` | [`EMITNULLIFIER`](./instruction-set#isa-section-emitnullifier) | +| `nullifiers` | Nullifiers | `Vector` | [`EMITNULLIFIER`](./instruction-set#isa-section-emitnullifier) | | `l1ToL2MessageChecks` | L1-To-L2 Messages | `Vector` | [`L1TOL2MSGEXISTS`](./instruction-set#isa-section-l1tol2msgexists) | | `archiveChecks` | Headers | `Vector` | [`HEADERMEMBER`](./instruction-set#isa-section-headermember) | diff --git a/docs/docs/protocol-specs/transactions/tx-object.md b/docs/docs/protocol-specs/transactions/tx-object.md index 9bec884dcfd..821927edb39 100644 --- a/docs/docs/protocol-specs/transactions/tx-object.md +++ b/docs/docs/protocol-specs/transactions/tx-object.md @@ -40,12 +40,12 @@ Output of the last iteration of the private kernel circuit. Includes _accumulate | Field | Type | Description | |-------|------|-------------| -| newNoteHashes | Field[] | The new note hashes made in this transaction. | -| newNullifiers | Field[] | The new nullifiers made in this transaction. | +| noteHashes | Field[] | The new note hashes made in this transaction. | +| nullifiers | Field[] | The new nullifiers made in this transaction. | | nullifiedNoteHashes | Field[] | The note hashes which are nullified by a nullifier in the above list. | | privateCallStack | Field[] | Current private call stack. | | publicCallStack | Field[] | Current public call stack. | -| newL2ToL1Msgs | Field[] | All the new L2 to L1 messages created in this transaction. | +| l2ToL1Msgs | Field[] | All the new L2 to L1 messages created in this transaction. | | encryptedLogsHash | Field[] | Accumulated encrypted logs hash from all the previous kernel iterations. | | unencryptedLogsHash | Field[] | Accumulated unencrypted logs hash from all the previous kernel iterations. | | encryptedLogPreimagesLength | Field | Total accumulated length of the encrypted log preimages emitted in all the previous kernel iterations. | diff --git a/docs/src/preprocess/InstructionSet/InstructionSet.js b/docs/src/preprocess/InstructionSet/InstructionSet.js index 5fd93fc92e3..129a41a6e1a 100644 --- a/docs/src/preprocess/InstructionSet/InstructionSet.js +++ b/docs/src/preprocess/InstructionSet/InstructionSet.js @@ -1119,7 +1119,7 @@ context.worldState.noteHashes.append( `, Summary: "Emit a new note hash to be inserted into the note hash tree", "World State access tracing": ` -context.worldStateAccessTrace.newNoteHashes.append( +context.worldStateAccessTrace.noteHashes.append( TracedNoteHash { callPointer: context.environment.callPointer, noteHash: M[noteHashOffset], // unsiloed note hash @@ -1191,7 +1191,7 @@ context.worldState.nullifiers.append( `, Summary: "Emit a new nullifier to be inserted into the nullifier tree", "World State access tracing": ` -context.worldStateAccessTrace.newNullifiers.append( +context.worldStateAccessTrace.nullifiers.append( TracedNullifier { callPointer: context.environment.callPointer, nullifier: M[nullifierOffset], // unsiloed nullifier diff --git a/l1-contracts/src/core/libraries/ConstantsGen.sol b/l1-contracts/src/core/libraries/ConstantsGen.sol index 2d13d85bb09..8059d997c24 100644 --- a/l1-contracts/src/core/libraries/ConstantsGen.sol +++ b/l1-contracts/src/core/libraries/ConstantsGen.sol @@ -15,11 +15,11 @@ library Constants { uint256 internal constant MAX_FIELD_VALUE = P - 1; uint256 internal constant ARGS_LENGTH = 16; - uint256 internal constant MAX_NEW_NOTE_HASHES_PER_CALL = 16; - uint256 internal constant MAX_NEW_NULLIFIERS_PER_CALL = 16; + uint256 internal constant MAX_NOTE_HASHES_PER_CALL = 16; + uint256 internal constant MAX_NULLIFIERS_PER_CALL = 16; uint256 internal constant MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL = 4; uint256 internal constant MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL = 16; - uint256 internal constant MAX_NEW_L2_TO_L1_MSGS_PER_CALL = 2; + uint256 internal constant MAX_L2_TO_L1_MSGS_PER_CALL = 2; uint256 internal constant MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL = 32; uint256 internal constant MAX_PUBLIC_DATA_READS_PER_CALL = 32; uint256 internal constant MAX_NOTE_HASH_READ_REQUESTS_PER_CALL = 16; @@ -30,15 +30,15 @@ library Constants { uint256 internal constant MAX_NOTE_ENCRYPTED_LOGS_PER_CALL = 16; uint256 internal constant MAX_ENCRYPTED_LOGS_PER_CALL = 4; uint256 internal constant MAX_UNENCRYPTED_LOGS_PER_CALL = 4; - uint256 internal constant MAX_NEW_NOTE_HASHES_PER_TX = 64; - uint256 internal constant MAX_NEW_NULLIFIERS_PER_TX = 64; + uint256 internal constant MAX_NOTE_HASHES_PER_TX = 64; + uint256 internal constant MAX_NULLIFIERS_PER_TX = 64; uint256 internal constant MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX = 8; uint256 internal constant MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX = 32; uint256 internal constant MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX = 63; uint256 internal constant PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX = 1; uint256 internal constant MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX = 64; uint256 internal constant MAX_PUBLIC_DATA_READS_PER_TX = 64; - uint256 internal constant MAX_NEW_L2_TO_L1_MSGS_PER_TX = 8; + uint256 internal constant MAX_L2_TO_L1_MSGS_PER_TX = 8; uint256 internal constant MAX_NOTE_HASH_READ_REQUESTS_PER_TX = 64; uint256 internal constant MAX_NULLIFIER_READ_REQUESTS_PER_TX = 64; uint256 internal constant MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX = 64; diff --git a/l1-contracts/test/Rollup.t.sol b/l1-contracts/test/Rollup.t.sol index 3523412dd81..97f6080fb04 100644 --- a/l1-contracts/test/Rollup.t.sol +++ b/l1-contracts/test/Rollup.t.sol @@ -170,7 +170,7 @@ contract RollupTest is DecoderBase { full.messages.l2ToL1Messages.length == 0 ? 0 : full.messages.l2ToL1Messages.length / numTxs ); uint256 outHashTreeHeight = merkleTestUtil.calculateTreeHeightFromSize(numTxs); - uint256 numMessagesWithPadding = numTxs * Constants.MAX_NEW_L2_TO_L1_MSGS_PER_TX; + uint256 numMessagesWithPadding = numTxs * Constants.MAX_L2_TO_L1_MSGS_PER_TX; uint256 treeHeight = subTreeHeight + outHashTreeHeight; NaiveMerkle tree = new NaiveMerkle(treeHeight); diff --git a/noir-projects/aztec-nr/authwit/src/auth.nr b/noir-projects/aztec-nr/authwit/src/auth.nr index 48d2f6b60b3..de42feab354 100644 --- a/noir-projects/aztec-nr/authwit/src/auth.nr +++ b/noir-projects/aztec-nr/authwit/src/auth.nr @@ -226,7 +226,7 @@ pub fn assert_inner_hash_valid_authwit(context: &mut PrivateContext, on_behalf_o // Compute the nullifier, similar computation to the outer hash, but without the chain_id and version. // Those should already be handled in the verification, so we just need something to nullify, that allow same inner_hash for multiple actors. let nullifier = compute_authwit_nullifier(on_behalf_of, inner_hash); - context.push_new_nullifier(nullifier, 0); + context.push_nullifier(nullifier, 0); } /** 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 48899a15876..4f8b7f657f5 100644 --- a/noir-projects/aztec-nr/aztec/src/context/private_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/private_context.nr @@ -23,7 +23,7 @@ use dep::protocol_types::{ }, address::{AztecAddress, EthAddress}, constants::{ - MAX_NEW_NOTE_HASHES_PER_CALL, MAX_NEW_L2_TO_L1_MSGS_PER_CALL, MAX_NEW_NULLIFIERS_PER_CALL, + MAX_NOTE_HASHES_PER_CALL, MAX_L2_TO_L1_MSGS_PER_CALL, MAX_NULLIFIERS_PER_CALL, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_KEY_VALIDATION_REQUESTS_PER_CALL, MAX_ENCRYPTED_LOGS_PER_CALL, MAX_UNENCRYPTED_LOGS_PER_CALL, @@ -50,13 +50,13 @@ struct PrivateContext { nullifier_read_requests: BoundedVec, key_validation_requests_and_generators: BoundedVec, - new_note_hashes: BoundedVec, - new_nullifiers: BoundedVec, + note_hashes: BoundedVec, + nullifiers: BoundedVec, private_call_requests : BoundedVec, public_call_stack_hashes : BoundedVec, public_teardown_function_hash: Field, - new_l2_to_l1_msgs : BoundedVec, + l2_to_l1_msgs : BoundedVec, // docs:end:private-context // Header of a block whose state is used during private execution (not the block the transaction is included in). @@ -85,13 +85,13 @@ impl PrivateContext { note_hash_read_requests: BoundedVec::new(), nullifier_read_requests: BoundedVec::new(), key_validation_requests_and_generators: BoundedVec::new(), - new_note_hashes: BoundedVec::new(), - new_nullifiers: BoundedVec::new(), + note_hashes: BoundedVec::new(), + nullifiers: BoundedVec::new(), historical_header: inputs.historical_header, private_call_requests: BoundedVec::new(), public_call_stack_hashes: BoundedVec::new(), public_teardown_function_hash: 0, - new_l2_to_l1_msgs: BoundedVec::new(), + l2_to_l1_msgs: BoundedVec::new(), note_encrypted_logs_hashes: BoundedVec::new(), encrypted_logs_hashes: BoundedVec::new(), unencrypted_logs_hashes: BoundedVec::new(), @@ -123,14 +123,14 @@ impl PrivateContext { self.args_hash } - fn push_new_note_hash(&mut self, note_hash: Field) { - self.new_note_hashes.push(NoteHash { value: note_hash, counter: self.next_counter() }); + fn push_note_hash(&mut self, note_hash: Field) { + self.note_hashes.push(NoteHash { value: note_hash, counter: self.next_counter() }); } // TODO(#7112): This function is called with non-zero note hash only in 1 of 25 cases in aztec-packages repo // - consider creating a separate function with 1 arg for the zero note hash case. - fn push_new_nullifier(&mut self, nullifier: Field, nullified_note_hash: Field) { - self.new_nullifiers.push(Nullifier { value: nullifier, note_hash: nullified_note_hash, counter: self.next_counter() }); + fn push_nullifier(&mut self, nullifier: Field, nullified_note_hash: Field) { + self.nullifiers.push(Nullifier { value: nullifier, note_hash: nullified_note_hash, counter: self.next_counter() }); } // Returns the header of a block whose state is used during private execution (not the block the transaction is @@ -161,12 +161,12 @@ impl PrivateContext { note_hash_read_requests: self.note_hash_read_requests.storage, nullifier_read_requests: self.nullifier_read_requests.storage, key_validation_requests_and_generators: self.key_validation_requests_and_generators.storage, - new_note_hashes: self.new_note_hashes.storage, - new_nullifiers: self.new_nullifiers.storage, + note_hashes: self.note_hashes.storage, + nullifiers: self.nullifiers.storage, private_call_requests: self.private_call_requests.storage, public_call_stack_hashes: self.public_call_stack_hashes.storage, public_teardown_function_hash: self.public_teardown_function_hash, - new_l2_to_l1_msgs: self.new_l2_to_l1_msgs.storage, + l2_to_l1_msgs: self.l2_to_l1_msgs.storage, start_side_effect_counter: self.inputs.start_side_effect_counter, end_side_effect_counter: self.side_effect_counter, note_encrypted_logs_hashes: self.note_encrypted_logs_hashes.storage, @@ -238,7 +238,7 @@ impl PrivateContext { pub fn message_portal(&mut self, recipient: EthAddress, content: Field) { // docs:end:context_message_portal let message = L2ToL1Message { recipient, content, counter: self.next_counter() }; - self.new_l2_to_l1_msgs.push(message); + self.l2_to_l1_msgs.push(message); } // docs:start:context_consume_l1_to_l2_message @@ -256,7 +256,7 @@ impl PrivateContext { ); // Push nullifier (and the "commitment" corresponding to this can be "empty") - self.push_new_nullifier(nullifier, 0) + self.push_nullifier(nullifier, 0) } // docs:end:consume_l1_to_l2_message @@ -598,12 +598,12 @@ impl Empty for PrivateContext { note_hash_read_requests: BoundedVec::new(), nullifier_read_requests: BoundedVec::new(), key_validation_requests_and_generators: BoundedVec::new(), - new_note_hashes: BoundedVec::new(), - new_nullifiers: BoundedVec::new(), + note_hashes: BoundedVec::new(), + nullifiers: BoundedVec::new(), private_call_requests: BoundedVec::new(), public_call_stack_hashes: BoundedVec::new(), public_teardown_function_hash: 0, - new_l2_to_l1_msgs: BoundedVec::new(), + l2_to_l1_msgs: BoundedVec::new(), historical_header: Header::empty(), note_encrypted_logs_hashes: BoundedVec::new(), encrypted_logs_hashes: BoundedVec::new(), 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 234d5ce5f85..1bfaea42d39 100644 --- a/noir-projects/aztec-nr/aztec/src/context/public_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/public_context.nr @@ -56,7 +56,7 @@ impl PublicContext { ); // Push nullifier (and the "commitment" corresponding to this can be "empty") - self.push_new_nullifier(nullifier, 0); + self.push_nullifier(nullifier, 0); } fn message_portal(&mut self, recipient: EthAddress, content: Field) { @@ -111,10 +111,10 @@ impl PublicContext { FunctionReturns::new([0; RETURNS_COUNT]) } - fn push_new_note_hash(&mut self, note_hash: Field) { + fn push_note_hash(&mut self, note_hash: Field) { emit_note_hash(note_hash); } - fn push_new_nullifier(&mut self, nullifier: Field, _nullified_commitment: Field) { + fn push_nullifier(&mut self, nullifier: Field, _nullified_commitment: Field) { // Cannot nullify pending commitments in AVM, so `nullified_commitment` is not used emit_nullifier(nullifier); } diff --git a/noir-projects/aztec-nr/aztec/src/encrypted_logs/encrypted_note_emission.nr b/noir-projects/aztec-nr/aztec/src/encrypted_logs/encrypted_note_emission.nr index 8a82eccdfc4..5c05dce4d20 100644 --- a/noir-projects/aztec-nr/aztec/src/encrypted_logs/encrypted_note_emission.nr +++ b/noir-projects/aztec-nr/aztec/src/encrypted_logs/encrypted_note_emission.nr @@ -4,7 +4,7 @@ use crate::{ }; use dep::protocol_types::{ hash::sha256_to_field, address::AztecAddress, grumpkin_point::GrumpkinPoint, - abis::note_hash::NoteHash, constants::MAX_NEW_NOTE_HASHES_PER_CALL, utils::arrays::find_index + abis::note_hash::NoteHash, constants::MAX_NOTE_HASHES_PER_CALL, utils::arrays::find_index }; unconstrained fn compute_unconstrained( @@ -43,11 +43,11 @@ fn emit_with_keys( let storage_slot = note_header.storage_slot; let note_exists_index = find_index( - context.new_note_hashes.storage, + context.note_hashes.storage, |n: NoteHash| n.counter == note_hash_counter ); assert( - note_exists_index as u32 != MAX_NEW_NOTE_HASHES_PER_CALL, "Can only emit a note log for an existing note." + note_exists_index as u32 != MAX_NOTE_HASHES_PER_CALL, "Can only emit a note log for an existing note." ); let contract_address: AztecAddress = context.this_address(); diff --git a/noir-projects/aztec-nr/aztec/src/initializer.nr b/noir-projects/aztec-nr/aztec/src/initializer.nr index 4bf7c817053..3dff18d094b 100644 --- a/noir-projects/aztec-nr/aztec/src/initializer.nr +++ b/noir-projects/aztec-nr/aztec/src/initializer.nr @@ -10,12 +10,12 @@ use crate::{ pub fn mark_as_initialized_public(context: &mut PublicContext) { let init_nullifier = compute_unsiloed_contract_initialization_nullifier((*context).this_address()); - context.push_new_nullifier(init_nullifier, 0); + context.push_nullifier(init_nullifier, 0); } pub fn mark_as_initialized_private(context: &mut PrivateContext) { let init_nullifier = compute_unsiloed_contract_initialization_nullifier((*context).this_address()); - context.push_new_nullifier(init_nullifier, 0); + context.push_nullifier(init_nullifier, 0); } pub fn assert_is_initialized_public(context: &mut PublicContext) { diff --git a/noir-projects/aztec-nr/aztec/src/note/lifecycle.nr b/noir-projects/aztec-nr/aztec/src/note/lifecycle.nr index 7fe6021326a..e9b4ac556f6 100644 --- a/noir-projects/aztec-nr/aztec/src/note/lifecycle.nr +++ b/noir-projects/aztec-nr/aztec/src/note/lifecycle.nr @@ -30,7 +30,7 @@ pub fn create_note( == 0 ); - context.push_new_note_hash(inner_note_hash); + context.push_note_hash(inner_note_hash); NoteEmission::new(*note) } @@ -46,7 +46,7 @@ pub fn create_note_hash_from_public( note.set_header(header); let inner_note_hash = compute_inner_note_hash(*note); - context.push_new_note_hash(inner_note_hash); + context.push_note_hash(inner_note_hash); } pub fn destroy_note( @@ -71,5 +71,5 @@ pub fn destroy_note( let nullifier_counter = context.side_effect_counter; assert(notify_nullified_note(nullifier, note_hash_for_consumption, nullifier_counter) == 0); - context.push_new_nullifier(nullifier, note_hash_for_consumption) + context.push_nullifier(nullifier, note_hash_for_consumption) } 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 d512a3bf070..7d9e0322217 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 @@ -10,7 +10,7 @@ use dep::protocol_types::{ utils::reader::Reader, constants::{ MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, - MAX_NEW_NOTE_HASHES_PER_CALL, MAX_NEW_L2_TO_L1_MSGS_PER_CALL, MAX_NEW_NULLIFIERS_PER_CALL, + MAX_NOTE_HASHES_PER_CALL, MAX_L2_TO_L1_MSGS_PER_CALL, MAX_NULLIFIERS_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_DATA_READS_PER_CALL, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL, MAX_UNENCRYPTED_LOGS_PER_CALL, @@ -94,9 +94,9 @@ pub fn parse_public_call_stack_item_from_oracle(fields: [Field; ENQUEUE_PUBLIC_F contract_storage_update_requests: [StorageUpdateRequest::empty(); MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL], contract_storage_reads: [StorageRead::empty(); MAX_PUBLIC_DATA_READS_PER_CALL], public_call_stack_hashes: [0; MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL], - new_note_hashes: [NoteHash::empty(); MAX_NEW_NOTE_HASHES_PER_CALL], - new_nullifiers: [Nullifier::empty(); MAX_NEW_NULLIFIERS_PER_CALL], - new_l2_to_l1_msgs: [L2ToL1Message::empty(); MAX_NEW_L2_TO_L1_MSGS_PER_CALL], + note_hashes: [NoteHash::empty(); MAX_NOTE_HASHES_PER_CALL], + nullifiers: [Nullifier::empty(); MAX_NULLIFIERS_PER_CALL], + l2_to_l1_msgs: [L2ToL1Message::empty(); MAX_L2_TO_L1_MSGS_PER_CALL], start_side_effect_counter: 0, end_side_effect_counter: 0, unencrypted_logs_hashes: [LogHash::empty(); MAX_UNENCRYPTED_LOGS_PER_CALL], diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr b/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr index 0c310180181..cb909e64a4b 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr @@ -50,7 +50,7 @@ impl PrivateImmutable { ) -> NoteEmission where Note: NoteInterface { // Nullify the storage slot. let nullifier = self.compute_initialization_nullifier(); - self.context.push_new_nullifier(nullifier, 0); + self.context.push_nullifier(nullifier, 0); create_note(self.context, self.storage_slot, note) } diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr b/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr index cf0ee4d7aac..d36c5af8b3a 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr @@ -54,7 +54,7 @@ impl PrivateMutable { ) -> NoteEmission where Note: NoteInterface { // Nullify the storage slot. let nullifier = self.compute_initialization_nullifier(); - self.context.push_new_nullifier(nullifier, 0); + self.context.push_nullifier(nullifier, 0); create_note(self.context, self.storage_slot, note) } diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable/test.nr b/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable/test.nr index 4da6f215b25..61f142c1161 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable/test.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable/test.nr @@ -36,13 +36,13 @@ fn test_initialize_or_replace_without_nullifier() { // - a new note being created // - no notes being read // - the initialization nullifier being emitted - assert_eq(state_var.context.new_note_hashes.len(), 1); + assert_eq(state_var.context.note_hashes.len(), 1); assert_eq(state_var.context.note_hash_read_requests.len(), 0); - assert_eq(state_var.context.new_nullifiers.len(), 1); + assert_eq(state_var.context.nullifiers.len(), 1); // Note that if the oracle was wrong and the initialization nullifier did exist, this attempt to write it again // would cause the sequencer to revert this transaction - we are therefore safe from bad oracles. - let nullifier = state_var.context.new_nullifiers.get(0); + let nullifier = state_var.context.nullifiers.get(0); assert_eq(nullifier.value, state_var.compute_initialization_nullifier()); assert_eq(nullifier.note_hash, 0); } diff --git a/noir-projects/aztec-nr/aztec/src/test/helpers/utils.nr b/noir-projects/aztec-nr/aztec/src/test/helpers/utils.nr index 28ca84b1f74..12b5fddf263 100644 --- a/noir-projects/aztec-nr/aztec/src/test/helpers/utils.nr +++ b/noir-projects/aztec-nr/aztec/src/test/helpers/utils.nr @@ -14,14 +14,14 @@ use crate::oracle::notes::notify_nullified_note; pub fn apply_side_effects_private(contract_address: AztecAddress, public_inputs: PrivateCircuitPublicInputs) { let mut nullifiers = &[]; - for nullifier in public_inputs.new_nullifiers { + for nullifier in public_inputs.nullifiers { if nullifier.value != 0 { nullifiers = nullifiers.push_back(nullifier.value); } } cheatcodes::add_nullifiers(contract_address, nullifiers); let mut note_hashes = &[]; - for note_hash in public_inputs.new_note_hashes { + for note_hash in public_inputs.note_hashes { if note_hash.value != 0 { note_hashes = note_hashes.push_back(note_hash.value); } 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 6132c880cb3..4560fbf6151 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 @@ -356,13 +356,13 @@ contract AvmTest { // Use the standard context interface to emit a new note hash #[aztec(public)] fn new_note_hash(note_hash: Field) { - context.push_new_note_hash(note_hash); + context.push_note_hash(note_hash); } // Use the standard context interface to emit a new nullifier #[aztec(public)] fn new_nullifier(nullifier: Field) { - context.push_new_nullifier(nullifier, 0); + context.push_nullifier(nullifier, 0); } // Use the standard context interface to check for a nullifier @@ -379,7 +379,7 @@ contract AvmTest { // Use the standard context interface to emit a new nullifier #[aztec(public)] fn emit_nullifier_and_check(nullifier: Field) { - context.push_new_nullifier(nullifier, 0); + context.push_nullifier(nullifier, 0); let exists = context.nullifier_exists(nullifier, context.storage_address()); assert(exists, "Nullifier was just created, but its existence wasn't detected!"); } @@ -387,9 +387,9 @@ contract AvmTest { // Create the same nullifier twice (shouldn't work!) #[aztec(public)] fn nullifier_collision(nullifier: Field) { - context.push_new_nullifier(nullifier, 0); + context.push_nullifier(nullifier, 0); // Can't do this twice! - context.push_new_nullifier(nullifier, 0); + context.push_nullifier(nullifier, 0); } #[aztec(public)] @@ -435,13 +435,13 @@ contract AvmTest { #[aztec(public)] fn create_same_nullifier_in_nested_call(nestedAddress: AztecAddress, nullifier: Field) { - context.push_new_nullifier(nullifier, 0); + context.push_nullifier(nullifier, 0); AvmTest::at(nestedAddress).new_nullifier(nullifier).call(&mut context); } #[aztec(public)] fn create_different_nullifier_in_nested_call(nestedAddress: AztecAddress, nullifier: Field) { - context.push_new_nullifier(nullifier, 0); + context.push_nullifier(nullifier, 0); AvmTest::at(nestedAddress).new_nullifier(nullifier + 1).call(&mut context); } diff --git a/noir-projects/noir-contracts/contracts/claim_contract/src/main.nr b/noir-projects/noir-contracts/contracts/claim_contract/src/main.nr index d191ca8fe8a..0d7fe868d50 100644 --- a/noir-projects/noir-contracts/contracts/claim_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/claim_contract/src/main.nr @@ -39,7 +39,7 @@ contract Claim { // The nullifier is unique to the note and THIS contract because the protocol siloes all nullifiers with // the address of a contract it was emitted from. let (_, nullifier) = proof_note.compute_note_hash_and_nullifier(&mut context); - context.push_new_nullifier(nullifier, 0); + context.push_nullifier(nullifier, 0); // 4) Finally we mint the reward token to the sender of the transaction Token::at(storage.reward_token.read_private()).mint_public(recipient, proof_note.value).enqueue(&mut context); diff --git a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr index 16d6f1ceaf6..3d2a944e38b 100644 --- a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr @@ -42,7 +42,7 @@ contract ContractClassRegisterer { // Emit the contract class id as a nullifier to be able to prove that this class has been (not) registered let event = ContractClassRegistered { contract_class_id, version: 1, artifact_hash, private_functions_root, packed_public_bytecode }; - context.push_new_nullifier(contract_class_id.to_field(), 0); + context.push_nullifier(contract_class_id.to_field(), 0); // Broadcast class info including public bytecode dep::aztec::oracle::debug_log::debug_log_format( diff --git a/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr b/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr index 56f5e4827f5..6b9582d3d79 100644 --- a/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr @@ -59,7 +59,7 @@ contract ContractInstanceDeployer { let address = AztecAddress::compute(public_keys_hash, partial_address); // Emit the address as a nullifier to be able to prove that this instance has been (not) deployed - context.push_new_nullifier(address.to_field(), 0); + context.push_nullifier(address.to_field(), 0); // Broadcast the event let event = ContractInstanceDeployed { contract_class_id, address, public_keys_hash, initialization_hash, salt, deployer, version: 1 }; diff --git a/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/main.nr b/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/main.nr index 23e9d09c9d3..774034e276a 100644 --- a/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/main.nr @@ -35,7 +35,7 @@ contract EasyPrivateVoting { let secret = context.request_nsk_app(msg_sender_npk_m_hash); // get secret key of caller of function let nullifier = std::hash::pedersen_hash([context.msg_sender().to_field(), secret]); // derive nullifier from sender and secret - context.push_new_nullifier(nullifier, 0); // push nullifier + context.push_nullifier(nullifier, 0); // push nullifier EasyPrivateVoting::at(context.this_address()).add_to_tally_public(candidate).enqueue(&mut context); } // docs:end:cast_vote diff --git a/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr b/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr index 875686868c4..35f5a5aace6 100644 --- a/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr @@ -179,7 +179,7 @@ contract InclusionProofs { #[aztec(public)] fn push_nullifier_public(nullifier: Field) { - context.push_new_nullifier(nullifier, 0); + context.push_nullifier(nullifier, 0); } // Proves nullifier existed at latest block diff --git a/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr b/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr index c35c36d6eb5..a3ecd0781a2 100644 --- a/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr @@ -7,7 +7,7 @@ contract PendingNoteHashes { use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, Map, PrivateSet}; use dep::value_note::{balance_utils, filter::filter_notes_min_sum, value_note::{VALUE_NOTE_LEN, ValueNote}}; use dep::aztec::protocol_types::grumpkin_point::GrumpkinPoint; - use dep::aztec::protocol_types::constants::{MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NEW_NOTE_HASHES_PER_CALL}; + use dep::aztec::protocol_types::constants::{MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NOTE_HASHES_PER_CALL}; use dep::aztec::encrypted_logs::encrypted_note_emission::{encode_and_encrypt_note, encode_and_encrypt_note_with_keys}; use dep::aztec::note::note_emission::NoteEmission; @@ -395,10 +395,10 @@ contract PendingNoteHashes { #[contract_library_method] fn max_notes_per_call() -> u32 { - if MAX_NEW_NOTE_HASHES_PER_CALL > MAX_NOTE_HASH_READ_REQUESTS_PER_CALL { + if MAX_NOTE_HASHES_PER_CALL > MAX_NOTE_HASH_READ_REQUESTS_PER_CALL { MAX_NOTE_HASH_READ_REQUESTS_PER_CALL } else { - MAX_NEW_NOTE_HASHES_PER_CALL + MAX_NOTE_HASHES_PER_CALL } } } diff --git a/noir-projects/noir-contracts/contracts/private_fpc_contract/src/main.nr b/noir-projects/noir-contracts/contracts/private_fpc_contract/src/main.nr index a049442a53f..5476f6fdb77 100644 --- a/noir-projects/noir-contracts/contracts/private_fpc_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/private_fpc_contract/src/main.nr @@ -23,7 +23,7 @@ contract PrivateFPC { fn fund_transaction_privately(amount: Field, asset: AztecAddress, nonce: Field) { assert(asset == storage.other_asset.read_private()); // convince the FPC we are not cheating - context.push_new_nullifier(nonce, 0); + context.push_nullifier(nonce, 0); // allow the FPC to reconstruct their fee note emit_nonce_as_unencrypted_log(&mut context, nonce); diff --git a/noir-projects/noir-contracts/contracts/private_token_contract/src/main.nr b/noir-projects/noir-contracts/contracts/private_token_contract/src/main.nr index 14aa6690b6e..c3643b1ff39 100644 --- a/noir-projects/noir-contracts/contracts/private_token_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/private_token_contract/src/main.nr @@ -199,13 +199,13 @@ contract PrivateToken { // `compute_inner_note_hash` manually, without constructing the note // `3` is the storage slot of the balances - context.push_new_note_hash( + context.push_note_hash( pedersen_hash( [PrivateToken::storage().balances.slot, note_hashes[0]], GENERATOR_INDEX__INNER_NOTE_HASH ) ); - context.push_new_note_hash( + context.push_note_hash( pedersen_hash( [PrivateToken::storage().balances.slot, note_hashes[1]], GENERATOR_INDEX__INNER_NOTE_HASH diff --git a/noir-projects/noir-contracts/contracts/test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/test_contract/src/main.nr index 2f8e598aa64..fbf10bc1806 100644 --- a/noir-projects/noir-contracts/contracts/test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/test_contract/src/main.nr @@ -247,13 +247,13 @@ contract Test { // Purely exists for testing #[aztec(public)] fn emit_nullifier_public(nullifier: Field) { - context.push_new_nullifier(nullifier, 0); + context.push_nullifier(nullifier, 0); } // Forcefully emits a nullifier (for testing purposes) #[aztec(private)] fn emit_nullifier(nullifier: Field) { - context.push_new_nullifier(nullifier, 0); + context.push_nullifier(nullifier, 0); } // For testing non-note encrypted logs diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_contract/src/main.nr index d1695732c06..3f8bdfd8bea 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/main.nr @@ -350,7 +350,7 @@ contract Token { fn cancel_authwit(inner_hash: Field) { let on_behalf_of = context.msg_sender(); let nullifier = compute_authwit_nullifier(on_behalf_of, inner_hash); - context.push_new_nullifier(nullifier, 0); + context.push_nullifier(nullifier, 0); } #[aztec(private)] diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/previous_kernel_validator.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/previous_kernel_validator.nr index 27d7ce6d667..ba886c57e8a 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/previous_kernel_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/previous_kernel_validator.nr @@ -65,11 +65,11 @@ impl PreviousKernelValidator { fn verify_no_transient_data(self) { // Currently all the transient note hashes and nullifiers must be cleared in the reset circuits. // Check that the propagated note hashes don't link to a nullifier, and vice versa. - for note_hash in self.previous_kernel.end.new_note_hashes { + for note_hash in self.previous_kernel.end.note_hashes { assert_eq(note_hash.nullifier_counter, 0, "Unresolved transient note hash"); } - for new_nullifier in self.previous_kernel.end.new_nullifiers { - assert_eq(new_nullifier.nullified_note_hash(), 0, "Unresolved transient nullifier"); + for nullifier in self.previous_kernel.end.nullifiers { + assert_eq(nullifier.nullified_note_hash(), 0, "Unresolved transient nullifier"); } } } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_call_data_validator.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_call_data_validator.nr index 5e0d9e6eee3..affec785a95 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_call_data_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_call_data_validator.nr @@ -247,11 +247,9 @@ impl PrivateCallDataValidator { if call_context.is_static_call { // No state changes are allowed for static calls: - assert_eq(self.array_lengths.new_note_hashes, 0, "new_note_hashes must be empty for static calls"); - assert_eq(self.array_lengths.new_nullifiers, 0, "new_nullifiers must be empty for static calls"); - assert_eq( - self.array_lengths.new_l2_to_l1_msgs, 0, "new_l2_to_l1_msgs must be empty for static calls" - ); + assert_eq(self.array_lengths.note_hashes, 0, "note_hashes must be empty for static calls"); + assert_eq(self.array_lengths.nullifiers, 0, "nullifiers must be empty for static calls"); + assert_eq(self.array_lengths.l2_to_l1_msgs, 0, "l2_to_l1_msgs must be empty for static calls"); assert_eq( self.array_lengths.note_encrypted_logs_hashes, 0, "note_encrypted_logs_hashes must be empty for static calls" ); @@ -317,20 +315,20 @@ impl PrivateCallDataValidator { validate_incrementing_counters_within_range( counter_start, counter_end, - public_inputs.new_note_hashes, - self.array_lengths.new_note_hashes + public_inputs.note_hashes, + self.array_lengths.note_hashes ); validate_incrementing_counters_within_range( counter_start, counter_end, - public_inputs.new_nullifiers, - self.array_lengths.new_nullifiers + public_inputs.nullifiers, + self.array_lengths.nullifiers ); validate_incrementing_counters_within_range( counter_start, counter_end, - public_inputs.new_l2_to_l1_msgs, - self.array_lengths.new_l2_to_l1_msgs + public_inputs.l2_to_l1_msgs, + self.array_lengths.l2_to_l1_msgs ); validate_incrementing_counters_within_range( counter_start, diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr index 898486eb8d9..e2050fd93a5 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr @@ -146,7 +146,7 @@ impl PrivateKernelCircuitOutputValidator { ) { self.validate_initial_values(tx_request, private_call, public_teardown_call_request); let mut offsets = PrivateKernelCircuitPublicInputsArrayLengths::empty(); - offsets.new_nullifiers = 1; // The first nullifier is not propagated from the private call. + offsets.nullifiers = 1; // The first nullifier is not propagated from the private call. self.validate_propagated_from_private_call( private_call, private_call_array_lengths, @@ -198,7 +198,7 @@ impl PrivateKernelCircuitOutputValidator { // First nullifier. let first_nullifier = create_first_nullifier(tx_request); assert_eq( - self.output.end.new_nullifiers[0], first_nullifier, "first nullifier must be the tx request nullifier" + self.output.end.nullifiers[0], first_nullifier, "first nullifier must be the tx request nullifier" ); // Others. @@ -293,19 +293,19 @@ impl PrivateKernelCircuitOutputValidator { array_lengths.scoped_key_validation_requests_and_generators ); validate_array_prepended( - self.output.end.new_note_hashes, - previous_kernel.end.new_note_hashes, - array_lengths.new_note_hashes + self.output.end.note_hashes, + previous_kernel.end.note_hashes, + array_lengths.note_hashes ); validate_array_prepended( - self.output.end.new_nullifiers, - previous_kernel.end.new_nullifiers, - array_lengths.new_nullifiers + self.output.end.nullifiers, + previous_kernel.end.nullifiers, + array_lengths.nullifiers ); validate_array_prepended( - self.output.end.new_l2_to_l1_msgs, - previous_kernel.end.new_l2_to_l1_msgs, - array_lengths.new_l2_to_l1_msgs + self.output.end.l2_to_l1_msgs, + previous_kernel.end.l2_to_l1_msgs, + array_lengths.l2_to_l1_msgs ); validate_array_prepended( self.output.end.note_encrypted_logs_hashes, @@ -369,30 +369,30 @@ impl PrivateKernelCircuitOutputValidator { storage_contract_address ); validate_array_appended_scoped( - self.output.end.new_note_hashes, - private_call.new_note_hashes, - array_lengths.new_note_hashes, - offsets.new_note_hashes, + self.output.end.note_hashes, + private_call.note_hashes, + array_lengths.note_hashes, + offsets.note_hashes, storage_contract_address ); validate_note_hash_nullifier_counters( - self.output.end.new_note_hashes, + self.output.end.note_hashes, note_hash_nullifier_counters, - array_lengths.new_note_hashes, - offsets.new_note_hashes + array_lengths.note_hashes, + offsets.note_hashes ); validate_array_appended_scoped( - self.output.end.new_nullifiers, - private_call.new_nullifiers, - array_lengths.new_nullifiers, - offsets.new_nullifiers, + self.output.end.nullifiers, + private_call.nullifiers, + array_lengths.nullifiers, + offsets.nullifiers, storage_contract_address ); validate_array_appended_scoped( - self.output.end.new_l2_to_l1_msgs, - private_call.new_l2_to_l1_msgs, - array_lengths.new_l2_to_l1_msgs, - offsets.new_l2_to_l1_msgs, + self.output.end.l2_to_l1_msgs, + private_call.l2_to_l1_msgs, + array_lengths.l2_to_l1_msgs, + offsets.l2_to_l1_msgs, storage_contract_address ); validate_array_appended( diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_public_inputs_composer.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_public_inputs_composer.nr index 2a0c27b2393..4b0dc85410b 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_public_inputs_composer.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_public_inputs_composer.nr @@ -7,7 +7,7 @@ use dep::types::{ }, address::AztecAddress, constants::{ - MAX_NEW_NOTE_HASHES_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NEW_NOTE_HASHES_PER_TX, + MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NOTE_HASHES_PER_TX, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL }, hash::{ @@ -22,7 +22,7 @@ struct DataSource { private_call_public_inputs: PrivateCircuitPublicInputs, contract_address: AztecAddress, storage_contract_address: AztecAddress, - note_hash_nullifier_counters: [u32; MAX_NEW_NOTE_HASHES_PER_CALL], + note_hash_nullifier_counters: [u32; MAX_NOTE_HASHES_PER_CALL], public_call_requests: [CallRequest; MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL], public_teardown_call_request: CallRequest, } @@ -44,8 +44,8 @@ impl PrivateKernelCircuitPublicInputsComposer { tx_request.tx_context, ); - // Since it's the first iteration, we need to push the tx hash nullifier into the `new_nullifiers` array - public_inputs.end.new_nullifiers.push(create_first_nullifier(tx_request)); + // Since it's the first iteration, we need to push the tx hash nullifier into the `nullifiers` array + public_inputs.end.nullifiers.push(create_first_nullifier(tx_request)); // Note that we do not need to nullify the transaction request nonce anymore. // Should an account want to additionally use nonces for replay protection or handling cancellations, // they will be able to do so in the account contract logic: @@ -69,9 +69,9 @@ impl PrivateKernelCircuitPublicInputsComposer { public_inputs.validation_requests.scoped_key_validation_requests_and_generators = array_to_bounded_vec(start.scoped_key_validation_requests_and_generators); let start = previous_kernel_public_inputs.end; - public_inputs.end.new_note_hashes = array_to_bounded_vec(start.new_note_hashes); - public_inputs.end.new_nullifiers = array_to_bounded_vec(start.new_nullifiers); - public_inputs.end.new_l2_to_l1_msgs = array_to_bounded_vec(start.new_l2_to_l1_msgs); + public_inputs.end.note_hashes = array_to_bounded_vec(start.note_hashes); + public_inputs.end.nullifiers = array_to_bounded_vec(start.nullifiers); + public_inputs.end.l2_to_l1_msgs = array_to_bounded_vec(start.l2_to_l1_msgs); public_inputs.end.note_encrypted_logs_hashes = array_to_bounded_vec(start.note_encrypted_logs_hashes); public_inputs.end.encrypted_logs_hashes = array_to_bounded_vec(start.encrypted_logs_hashes); public_inputs.end.unencrypted_logs_hashes = array_to_bounded_vec(start.unencrypted_logs_hashes); @@ -91,7 +91,7 @@ impl PrivateKernelCircuitPublicInputsComposer { &mut self, private_call_public_inputs: PrivateCircuitPublicInputs, contract_address: AztecAddress, - note_hash_nullifier_counters: [u32; MAX_NEW_NOTE_HASHES_PER_CALL], + note_hash_nullifier_counters: [u32; MAX_NOTE_HASHES_PER_CALL], public_call_requests: [CallRequest; MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL], public_teardown_call_request: CallRequest ) -> Self { @@ -181,7 +181,7 @@ impl PrivateKernelCircuitPublicInputsComposer { } fn propagate_note_hashes(&mut self, source: DataSource) { - let note_hashes = source.private_call_public_inputs.new_note_hashes; + let note_hashes = source.private_call_public_inputs.note_hashes; for i in 0..note_hashes.len() { let mut note_hash = note_hashes[i]; if note_hash.value != 0 { @@ -189,27 +189,27 @@ impl PrivateKernelCircuitPublicInputsComposer { assert( (nullifier_counter == 0) | (nullifier_counter > note_hash.counter), "Invalid nullifier counter" ); - self.public_inputs.end.new_note_hashes.push(note_hash.scope(nullifier_counter, source.storage_contract_address)); + self.public_inputs.end.note_hashes.push(note_hash.scope(nullifier_counter, source.storage_contract_address)); } } } fn propagate_nullifiers(&mut self, source: DataSource) { - let nullifiers = source.private_call_public_inputs.new_nullifiers; + let nullifiers = source.private_call_public_inputs.nullifiers; for i in 0..nullifiers.len() { let nullifier = nullifiers[i]; if nullifier.value != 0 { - self.public_inputs.end.new_nullifiers.push(nullifier.scope(source.storage_contract_address)); + self.public_inputs.end.nullifiers.push(nullifier.scope(source.storage_contract_address)); } } } fn propagate_l2_to_l1_messages(&mut self, source: DataSource) { - let l2_to_l1_msgs = source.private_call_public_inputs.new_l2_to_l1_msgs; + let l2_to_l1_msgs = source.private_call_public_inputs.l2_to_l1_msgs; for i in 0..l2_to_l1_msgs.len() { let msg = l2_to_l1_msgs[i]; if !is_empty(msg) { - self.public_inputs.end.new_l2_to_l1_msgs.push(msg.scope(source.storage_contract_address)); + self.public_inputs.end.l2_to_l1_msgs.push(msg.scope(source.storage_contract_address)); } } } @@ -281,9 +281,9 @@ impl PrivateKernelCircuitPublicInputsComposer { } fn sort_ordered_values(&mut self) { - self.public_inputs.end.new_note_hashes.storage = sort_by_counters_asc(self.public_inputs.end.new_note_hashes.storage); - self.public_inputs.end.new_nullifiers.storage = sort_by_counters_asc(self.public_inputs.end.new_nullifiers.storage); - self.public_inputs.end.new_l2_to_l1_msgs.storage = sort_by_counters_asc(self.public_inputs.end.new_l2_to_l1_msgs.storage); + self.public_inputs.end.note_hashes.storage = sort_by_counters_asc(self.public_inputs.end.note_hashes.storage); + self.public_inputs.end.nullifiers.storage = sort_by_counters_asc(self.public_inputs.end.nullifiers.storage); + self.public_inputs.end.l2_to_l1_msgs.storage = sort_by_counters_asc(self.public_inputs.end.l2_to_l1_msgs.storage); self.public_inputs.end.note_encrypted_logs_hashes.storage = sort_by_counters_asc(self.public_inputs.end.note_encrypted_logs_hashes.storage); self.public_inputs.end.encrypted_logs_hashes.storage = sort_by_counters_asc(self.public_inputs.end.encrypted_logs_hashes.storage); self.public_inputs.end.unencrypted_logs_hashes.storage = sort_by_counters_asc(self.public_inputs.end.unencrypted_logs_hashes.storage); @@ -299,10 +299,10 @@ impl PrivateKernelCircuitPublicInputsComposer { } fn silo_note_hashes(&mut self) { - let first_nullifier = self.public_inputs.end.new_nullifiers.get_unchecked(0).value(); - let note_hashes = self.public_inputs.end.new_note_hashes.storage; + let first_nullifier = self.public_inputs.end.nullifiers.get_unchecked(0).value(); + let note_hashes = self.public_inputs.end.note_hashes.storage; for i in 0..note_hashes.len() { - self.public_inputs.end.new_note_hashes.storage[i].note_hash.value = silo_note_hash( + self.public_inputs.end.note_hashes.storage[i].note_hash.value = silo_note_hash( note_hashes[i], first_nullifier, i @@ -311,17 +311,17 @@ impl PrivateKernelCircuitPublicInputsComposer { } fn silo_nullifiers(&mut self) { - let nullifiers = self.public_inputs.end.new_nullifiers.storage; + let nullifiers = self.public_inputs.end.nullifiers.storage; for i in 0..nullifiers.len() { - self.public_inputs.end.new_nullifiers.storage[i].nullifier.value = silo_nullifier(nullifiers[i]); + self.public_inputs.end.nullifiers.storage[i].nullifier.value = silo_nullifier(nullifiers[i]); } } fn silo_l2_to_l1_messages(&mut self) { - let l2_to_l1_msgs = self.public_inputs.end.new_l2_to_l1_msgs.storage; + let l2_to_l1_msgs = self.public_inputs.end.l2_to_l1_msgs.storage; let tx_context = self.public_inputs.constants.tx_context; for i in 0..l2_to_l1_msgs.len() { - self.public_inputs.end.new_l2_to_l1_msgs.storage[i].message.content = silo_l2_to_l1_message( + self.public_inputs.end.l2_to_l1_msgs.storage[i].message.content = silo_l2_to_l1_message( l2_to_l1_msgs[i], tx_context.version, tx_context.chain_id, diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_composer.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_composer.nr index 955a000f6e4..c958fab4182 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_composer.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_composer.nr @@ -36,9 +36,9 @@ impl TailOutputComposer { fn build_combined_accumulated_data(self) -> CombinedAccumulatedData { let source = self.output_composer.public_inputs.end; let mut data = CombinedAccumulatedData::empty(); - data.new_note_hashes = source.new_note_hashes.storage.map(|n: ScopedNoteHash| n.note_hash.value); - data.new_nullifiers = source.new_nullifiers.storage.map(|n: ScopedNullifier| n.nullifier.value); - data.new_l2_to_l1_msgs = source.new_l2_to_l1_msgs.storage.map(|m: ScopedL2ToL1Message| m.message.content); + data.note_hashes = source.note_hashes.storage.map(|n: ScopedNoteHash| n.note_hash.value); + data.nullifiers = source.nullifiers.storage.map(|n: ScopedNullifier| n.nullifier.value); + data.l2_to_l1_msgs = source.l2_to_l1_msgs.storage.map(|m: ScopedL2ToL1Message| m.message.content); data.note_encrypted_logs_hash = compute_tx_note_logs_hash(source.note_encrypted_logs_hashes.storage.map(|l: NoteLogHash| l.expose_to_public())); data.encrypted_logs_hash = compute_tx_logs_hash(source.encrypted_logs_hashes.storage.map(|l: ScopedEncryptedLogHash| l.expose_to_public())); data.unencrypted_logs_hash = compute_tx_logs_hash(source.unencrypted_logs_hashes.storage.map(|l: ScopedLogHash| l.expose_to_public())); @@ -55,9 +55,9 @@ impl TailOutputComposer { let data_builder = self.output_composer.public_inputs.end; // IMPORTANT: Must use data_builder.__.len(), which is the the number of items pushed to the BoundedVec. // Do not use data.__.len(), which is the array's max length. - metered_bytes += data_builder.new_note_hashes.len() * DA_BYTES_PER_FIELD; - metered_bytes += data_builder.new_nullifiers.len() * DA_BYTES_PER_FIELD; - metered_bytes += data_builder.new_l2_to_l1_msgs.len() * DA_BYTES_PER_FIELD; + metered_bytes += data_builder.note_hashes.len() * DA_BYTES_PER_FIELD; + metered_bytes += data_builder.nullifiers.len() * DA_BYTES_PER_FIELD; + metered_bytes += data_builder.l2_to_l1_msgs.len() * DA_BYTES_PER_FIELD; metered_bytes += data.note_encrypted_log_preimages_length as u32; metered_bytes += data.encrypted_log_preimages_length as u32; diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator.nr index add8346b798..81f3d225a47 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator.nr @@ -56,46 +56,46 @@ impl TailOutputValidator { fn validate_propagated_sorted_siloed_values(self, hints: Hints) { // First nullifier is tx hash. - let tx_hash = self.output.end.new_nullifiers[0]; - let unsiloed_note_hashes = self.previous_kernel.end.new_note_hashes; + let tx_hash = self.output.end.nullifiers[0]; + let unsiloed_note_hashes = self.previous_kernel.end.note_hashes; for i in 0..unsiloed_note_hashes.len() { let siloed_note_hash = silo_note_hash(unsiloed_note_hashes[i], tx_hash, i); assert_eq(hints.siloed_note_hashes[i], siloed_note_hash, "mismatch siloed note hashes"); } assert_sorted_transformed_value_array( - self.previous_kernel.end.new_note_hashes, + self.previous_kernel.end.note_hashes, hints.siloed_note_hashes, - self.output.end.new_note_hashes, + self.output.end.note_hashes, hints.sorted_note_hash_hints ); - // new_nullifiers + // nullifiers validate_transformed_values( - self.previous_kernel.end.new_nullifiers, + self.previous_kernel.end.nullifiers, hints.siloed_nullifiers, silo_nullifier ); assert_sorted_transformed_value_array( - self.previous_kernel.end.new_nullifiers, + self.previous_kernel.end.nullifiers, hints.siloed_nullifiers, - self.output.end.new_nullifiers, + self.output.end.nullifiers, hints.sorted_nullifier_hints ); - // new_l2_to_l1_msgs + // l2_to_l1_msgs let tx_context = self.previous_kernel.constants.tx_context; validate_transformed_values( - self.previous_kernel.end.new_l2_to_l1_msgs, + self.previous_kernel.end.l2_to_l1_msgs, hints.siloed_l2_to_l1_msgs, |msg| silo_l2_to_l1_message(msg, tx_context.version, tx_context.chain_id) ); assert_sorted_transformed_value_array( - self.previous_kernel.end.new_l2_to_l1_msgs, + self.previous_kernel.end.l2_to_l1_msgs, hints.siloed_l2_to_l1_msgs, - self.output.end.new_l2_to_l1_msgs, + self.output.end.l2_to_l1_msgs, hints.sorted_l2_to_l1_msg_hints ); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/kernel_circuit_output_hints.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/kernel_circuit_output_hints.nr index 716147ac73b..8309ae39aa1 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/kernel_circuit_output_hints.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/kernel_circuit_output_hints.nr @@ -4,8 +4,8 @@ use dep::types::{ log_hash::{LogHash, NoteLogHash, ScopedLogHash, ScopedEncryptedLogHash} }, constants::{ - MAX_ENCRYPTED_LOGS_PER_TX, MAX_NEW_L2_TO_L1_MSGS_PER_TX, MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX + MAX_ENCRYPTED_LOGS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, + MAX_NOTE_ENCRYPTED_LOGS_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX }, hash::{ silo_encrypted_log_hash, silo_l2_to_l1_message, silo_note_hash, silo_nullifier, @@ -17,14 +17,14 @@ use dep::types::{ struct Hints { // Note hashes. - sorted_note_hash_hints: [OrderHint; MAX_NEW_NOTE_HASHES_PER_TX], - siloed_note_hashes: [Field; MAX_NEW_NOTE_HASHES_PER_TX], + sorted_note_hash_hints: [OrderHint; MAX_NOTE_HASHES_PER_TX], + siloed_note_hashes: [Field; MAX_NOTE_HASHES_PER_TX], // Nullifiers. - sorted_nullifier_hints: [OrderHint; MAX_NEW_NULLIFIERS_PER_TX], - siloed_nullifiers: [Field; MAX_NEW_NULLIFIERS_PER_TX], + sorted_nullifier_hints: [OrderHint; MAX_NULLIFIERS_PER_TX], + siloed_nullifiers: [Field; MAX_NULLIFIERS_PER_TX], // L2 to l1 msgs. - sorted_l2_to_l1_msg_hints: [OrderHint; MAX_NEW_L2_TO_L1_MSGS_PER_TX], - siloed_l2_to_l1_msgs: [Field; MAX_NEW_L2_TO_L1_MSGS_PER_TX], + sorted_l2_to_l1_msg_hints: [OrderHint; MAX_L2_TO_L1_MSGS_PER_TX], + siloed_l2_to_l1_msgs: [Field; MAX_L2_TO_L1_MSGS_PER_TX], // Note encrypted log hashes. note_encrypted_log_hashes: [LogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], sorted_note_encrypted_log_hashes: [LogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], @@ -41,26 +41,26 @@ struct Hints { unconstrained pub fn generate_kernel_circuit_output_hints(previous_kernel: PrivateKernelCircuitPublicInputs) -> Hints { // note_hashes - let sorted_note_hash_hints = sort_get_order_hints_asc(previous_kernel.end.new_note_hashes); + let sorted_note_hash_hints = sort_get_order_hints_asc(previous_kernel.end.note_hashes); - let mut siloed_note_hashes = [0; MAX_NEW_NOTE_HASHES_PER_TX]; + let mut siloed_note_hashes = [0; MAX_NOTE_HASHES_PER_TX]; // First nullifier is tx hash. - let tx_hash = previous_kernel.end.new_nullifiers[0].value(); - let unsiloed_note_hashes = previous_kernel.end.new_note_hashes; + let tx_hash = previous_kernel.end.nullifiers[0].value(); + let unsiloed_note_hashes = previous_kernel.end.note_hashes; for i in 0..unsiloed_note_hashes.len() { siloed_note_hashes[i] = silo_note_hash(unsiloed_note_hashes[i], tx_hash, i); } // nullifiers - let sorted_nullifier_hints = sort_get_order_hints_asc(previous_kernel.end.new_nullifiers); - let siloed_nullifiers = previous_kernel.end.new_nullifiers.map(silo_nullifier); + let sorted_nullifier_hints = sort_get_order_hints_asc(previous_kernel.end.nullifiers); + let siloed_nullifiers = previous_kernel.end.nullifiers.map(silo_nullifier); // l2_to_l1_msgs - let sorted_l2_to_l1_msg_hints = sort_get_order_hints_asc(previous_kernel.end.new_l2_to_l1_msgs); + let sorted_l2_to_l1_msg_hints = sort_get_order_hints_asc(previous_kernel.end.l2_to_l1_msgs); let tx_context = previous_kernel.constants.tx_context; - let siloed_l2_to_l1_msgs = previous_kernel.end.new_l2_to_l1_msgs.map( + let siloed_l2_to_l1_msgs = previous_kernel.end.l2_to_l1_msgs.map( |m: ScopedL2ToL1Message| silo_l2_to_l1_message( m, tx_context.version, diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer/meter_gas_used.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer/meter_gas_used.nr index 8dc17f397bd..3a2ad4ac4ac 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer/meter_gas_used.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer/meter_gas_used.nr @@ -8,9 +8,9 @@ use dep::types::{ fn meter_gas_used(data: PublicAccumulatedDataBuilder) -> Gas { let mut metered_bytes = 0; - metered_bytes += data.new_note_hashes.len() * DA_BYTES_PER_FIELD; - metered_bytes += data.new_nullifiers.len() * DA_BYTES_PER_FIELD; - metered_bytes += data.new_l2_to_l1_msgs.len() * DA_BYTES_PER_FIELD; + metered_bytes += data.note_hashes.len() * DA_BYTES_PER_FIELD; + metered_bytes += data.nullifiers.len() * DA_BYTES_PER_FIELD; + metered_bytes += data.l2_to_l1_msgs.len() * DA_BYTES_PER_FIELD; let note_encrypted_log_preimages_length = data.note_encrypted_logs_hashes.storage.fold(0, |len, l: LogHash| len + l.length); metered_bytes += note_encrypted_log_preimages_length as u32; diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer/split_to_public.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer/split_to_public.nr index 0c9bb008ffa..424cca62483 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer/split_to_public.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer/split_to_public.nr @@ -12,43 +12,43 @@ pub fn split_to_public( let mut non_revertible_builder = PublicAccumulatedDataBuilder::empty(); let mut revertible_builder = PublicAccumulatedDataBuilder::empty(); - let note_hashes = data.new_note_hashes; + let note_hashes = data.note_hashes; for i in 0..note_hashes.max_len() { if i < note_hashes.len() { let note_hash = note_hashes.get_unchecked(i); let public_note_hash = note_hash.expose_to_public(); if note_hash.counter() < min_revertible_side_effect_counter { - non_revertible_builder.new_note_hashes.push(public_note_hash); + non_revertible_builder.note_hashes.push(public_note_hash); } else { - revertible_builder.new_note_hashes.push(public_note_hash); + revertible_builder.note_hashes.push(public_note_hash); } } } - let nullifiers = data.new_nullifiers; + let nullifiers = data.nullifiers; // First nullifier is always non-revertible. let first_nullifier = nullifiers.get_unchecked(0).expose_to_public(); - non_revertible_builder.new_nullifiers.push(first_nullifier); + non_revertible_builder.nullifiers.push(first_nullifier); for i in 1..nullifiers.max_len() { if i < nullifiers.len() { let nullifier = nullifiers.get_unchecked(i); let public_nullifier = nullifier.expose_to_public(); if nullifier.counter() < min_revertible_side_effect_counter { - non_revertible_builder.new_nullifiers.push(public_nullifier); + non_revertible_builder.nullifiers.push(public_nullifier); } else { - revertible_builder.new_nullifiers.push(public_nullifier); + revertible_builder.nullifiers.push(public_nullifier); } } } - let l2_to_l1_msgs = data.new_l2_to_l1_msgs; + let l2_to_l1_msgs = data.l2_to_l1_msgs; for i in 0..l2_to_l1_msgs.max_len() { if i < l2_to_l1_msgs.len() { let msg = l2_to_l1_msgs.get_unchecked(i); if msg.counter() < min_revertible_side_effect_counter { - non_revertible_builder.new_l2_to_l1_msgs.push(msg.message.content); + non_revertible_builder.l2_to_l1_msgs.push(msg.message.content); } else { - revertible_builder.new_l2_to_l1_msgs.push(msg.message.content); + revertible_builder.l2_to_l1_msgs.push(msg.message.content); } } } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator.nr index e642a8f4539..0cb8a53fa5f 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator.nr @@ -66,9 +66,9 @@ impl TailToPublicOutputValidator { let output_non_revertible = self.output.end_non_revertible; let output_revertible = self.output.end; - // new_note_hashes - let first_nullifier = output_non_revertible.new_nullifiers[0].value; - let unsiloed_note_hashes = prev_data.new_note_hashes; + // note_hashes + let first_nullifier = output_non_revertible.nullifiers[0].value; + let unsiloed_note_hashes = prev_data.note_hashes; for i in 0..unsiloed_note_hashes.len() { let siloed_note_hash = silo_note_hash(unsiloed_note_hashes[i], first_nullifier, i); assert_eq(hints.siloed_note_hashes[i].value, siloed_note_hash, "mismatch siloed note hashes"); @@ -76,43 +76,43 @@ impl TailToPublicOutputValidator { } assert_split_sorted_transformed_value_arrays_asc( - prev_data.new_note_hashes, + prev_data.note_hashes, hints.siloed_note_hashes, split_counter, - output_non_revertible.new_note_hashes, - output_revertible.new_note_hashes, + output_non_revertible.note_hashes, + output_revertible.note_hashes, hints.sorted_note_hash_hints ); - // new_nullifiers + // nullifiers validate_value_transformation( - prev_data.new_nullifiers, + prev_data.nullifiers, hints.siloed_nullifiers, |sn, n: Nullifier| (n.value == silo_nullifier(sn)) & (n.counter == 0) & (n.note_hash == 0) ); assert_split_sorted_transformed_value_arrays_asc( - prev_data.new_nullifiers, + prev_data.nullifiers, hints.siloed_nullifiers, split_counter, - output_non_revertible.new_nullifiers, - output_revertible.new_nullifiers, + output_non_revertible.nullifiers, + output_revertible.nullifiers, hints.sorted_nullifier_hints ); - // new_l2_to_l1_msgs + // l2_to_l1_msgs let tx_context = self.previous_kernel.constants.tx_context; validate_transformed_values( - prev_data.new_l2_to_l1_msgs, + prev_data.l2_to_l1_msgs, hints.siloed_l2_to_l1_msgs, |msg| silo_l2_to_l1_message(msg, tx_context.version, tx_context.chain_id) ); assert_split_sorted_transformed_value_arrays_asc( - prev_data.new_l2_to_l1_msgs, + prev_data.l2_to_l1_msgs, hints.siloed_l2_to_l1_msgs, split_counter, - output_non_revertible.new_l2_to_l1_msgs, - output_revertible.new_l2_to_l1_msgs, + output_non_revertible.l2_to_l1_msgs, + output_revertible.l2_to_l1_msgs, hints.sorted_l2_to_l1_msg_hints ); diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator/tail_to_public_output_hints.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator/tail_to_public_output_hints.nr index 7c47b24720d..12643aa6b50 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator/tail_to_public_output_hints.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator/tail_to_public_output_hints.nr @@ -5,9 +5,8 @@ use dep::types::{ nullifier::Nullifier }, constants::{ - MAX_ENCRYPTED_LOGS_PER_TX, MAX_NEW_L2_TO_L1_MSGS_PER_TX, MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, - MAX_UNENCRYPTED_LOGS_PER_TX + MAX_ENCRYPTED_LOGS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, + MAX_NOTE_ENCRYPTED_LOGS_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX }, hash::{ silo_encrypted_log_hash, silo_l2_to_l1_message, silo_note_hash, silo_nullifier, @@ -19,14 +18,14 @@ use dep::types::{ struct TailToPublicOutputHints { // Note hashes. - siloed_note_hashes: [NoteHash; MAX_NEW_NOTE_HASHES_PER_TX], - sorted_note_hash_hints: SplitOrderHints, + siloed_note_hashes: [NoteHash; MAX_NOTE_HASHES_PER_TX], + sorted_note_hash_hints: SplitOrderHints, // Nullifiers. - siloed_nullifiers: [Nullifier; MAX_NEW_NULLIFIERS_PER_TX], - sorted_nullifier_hints: SplitOrderHints, + siloed_nullifiers: [Nullifier; MAX_NULLIFIERS_PER_TX], + sorted_nullifier_hints: SplitOrderHints, // L2 to l1 msgs. - siloed_l2_to_l1_msgs: [Field; MAX_NEW_L2_TO_L1_MSGS_PER_TX], - sorted_l2_to_l1_msg_hints: SplitOrderHints, + siloed_l2_to_l1_msgs: [Field; MAX_L2_TO_L1_MSGS_PER_TX], + sorted_l2_to_l1_msg_hints: SplitOrderHints, // Note encrypted log hashes. note_encrypted_logs_hashes: [LogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], sorted_note_encrypted_log_hash_hints: SplitOrderHints, @@ -45,10 +44,10 @@ unconstrained pub fn generate_tail_to_public_output_hints(previous_kernel: Priva let split_counter = previous_kernel.min_revertible_side_effect_counter; // note_hashes - let unsiloed_note_hashes = previous_kernel.end.new_note_hashes; + let unsiloed_note_hashes = previous_kernel.end.note_hashes; - let first_nullifier = previous_kernel.end.new_nullifiers[0].value(); - let mut siloed_note_hashes = [NoteHash::empty(); MAX_NEW_NOTE_HASHES_PER_TX]; + let first_nullifier = previous_kernel.end.nullifiers[0].value(); + let mut siloed_note_hashes = [NoteHash::empty(); MAX_NOTE_HASHES_PER_TX]; for i in 0..unsiloed_note_hashes.len() { siloed_note_hashes[i].value = silo_note_hash(unsiloed_note_hashes[i], first_nullifier, i); } @@ -56,9 +55,9 @@ unconstrained pub fn generate_tail_to_public_output_hints(previous_kernel: Priva let sorted_note_hash_hints = sort_get_split_order_hints_asc(unsiloed_note_hashes, split_counter); // nullifiers - let unsiloed_nullifiers = previous_kernel.end.new_nullifiers; + let unsiloed_nullifiers = previous_kernel.end.nullifiers; - let mut siloed_nullifiers = [Nullifier::empty(); MAX_NEW_NULLIFIERS_PER_TX]; + let mut siloed_nullifiers = [Nullifier::empty(); MAX_NULLIFIERS_PER_TX]; for i in 0..unsiloed_nullifiers.len() { siloed_nullifiers[i].value = silo_nullifier(unsiloed_nullifiers[i]); } @@ -66,7 +65,7 @@ unconstrained pub fn generate_tail_to_public_output_hints(previous_kernel: Priva let sorted_nullifier_hints = sort_get_split_order_hints_asc(unsiloed_nullifiers, split_counter); // l2_to_l1_msgs - let unsiloed_l2_to_l1_msgs = previous_kernel.end.new_l2_to_l1_msgs; + let unsiloed_l2_to_l1_msgs = previous_kernel.end.l2_to_l1_msgs; let tx_context = previous_kernel.constants.tx_context; let siloed_l2_to_l1_msgs = unsiloed_l2_to_l1_msgs.map( diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_init.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_init.nr index 738e05833cb..6f2cde1763f 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_init.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_init.nr @@ -10,12 +10,12 @@ use dep::types::{ kernel_circuit_public_inputs::PrivateKernelCircuitPublicInputs, private_kernel::private_call_data::PrivateCallData }, - constants::MAX_NEW_NOTE_HASHES_PER_CALL, transaction::tx_request::TxRequest + constants::MAX_NOTE_HASHES_PER_CALL, transaction::tx_request::TxRequest }; struct PrivateKernelInitHints { // TODO: Remove note_hash_nullifier_counters. - note_hash_nullifier_counters: [u32; MAX_NEW_NOTE_HASHES_PER_CALL], + note_hash_nullifier_counters: [u32; MAX_NOTE_HASHES_PER_CALL], } // Initialization struct for private inputs to the private kernel @@ -45,7 +45,7 @@ impl PrivateKernelInitCircuitPrivateInputs { let private_call_data_validator = PrivateCallDataValidator::new(self.private_call); private_call_data_validator.validate_as_first_call(); private_call_data_validator.validate_against_tx_request(self.tx_request); - private_call_data_validator.validate(output.end.new_note_hashes); + private_call_data_validator.validate(output.end.note_hashes); if !std::runtime::is_unconstrained() { // verify/aggregate the private call proof self.private_call.verify(); @@ -71,7 +71,7 @@ mod tests { use crate::private_kernel_init::{PrivateKernelInitHints, PrivateKernelInitCircuitPrivateInputs}; use dep::types::{ abis::{kernel_circuit_public_inputs::PrivateKernelCircuitPublicInputs}, - constants::MAX_NEW_NOTE_HASHES_PER_CALL, + constants::MAX_NOTE_HASHES_PER_CALL, tests::{fixture_builder::FixtureBuilder, utils::assert_array_eq}, transaction::tx_request::TxRequest }; @@ -86,7 +86,7 @@ mod tests { pub fn new() -> Self { let private_call = FixtureBuilder::new(); let tx_request = private_call.build_tx_request(); - let hints = PrivateKernelInitHints { note_hash_nullifier_counters: [0; MAX_NEW_NOTE_HASHES_PER_CALL] }; + let hints = PrivateKernelInitHints { note_hash_nullifier_counters: [0; MAX_NOTE_HASHES_PER_CALL] }; PrivateKernelInitInputsBuilder { tx_request, private_call, hints } } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_inner.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_inner.nr index c46cec8a4b1..dab9e0d9e3f 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_inner.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_inner.nr @@ -10,11 +10,11 @@ use dep::types::{ kernel_circuit_public_inputs::{PrivateKernelCircuitPublicInputs, PrivateKernelCircuitPublicInputsArrayLengths}, private_kernel_data::PrivateKernelData, private_kernel::private_call_data::PrivateCallData }, - constants::MAX_NEW_NOTE_HASHES_PER_CALL + constants::MAX_NOTE_HASHES_PER_CALL }; struct PrivateKernelInnerHints { - note_hash_nullifier_counters: [u32; MAX_NEW_NOTE_HASHES_PER_CALL], + note_hash_nullifier_counters: [u32; MAX_NOTE_HASHES_PER_CALL], } struct PrivateKernelInnerCircuitPrivateInputs { @@ -45,7 +45,7 @@ impl PrivateKernelInnerCircuitPrivateInputs { let call_request = self.previous_kernel.public_inputs.end.private_call_stack[private_call_stack_size - 1]; private_call_data_validator.validate_against_call_request(call_request); private_call_data_validator.validate_against_previous_kernel(self.previous_kernel.public_inputs); - private_call_data_validator.validate(output.end.new_note_hashes); + private_call_data_validator.validate(output.end.note_hashes); if !std::runtime::is_unconstrained() { // verify/aggregate the private call proof self.private_call.verify(); @@ -74,7 +74,7 @@ mod tests { use crate::private_kernel_inner::{PrivateKernelInnerCircuitPrivateInputs, PrivateKernelInnerHints}; use dep::types::{ abis::{kernel_circuit_public_inputs::PrivateKernelCircuitPublicInputs}, - constants::MAX_NEW_NOTE_HASHES_PER_CALL, + constants::MAX_NOTE_HASHES_PER_CALL, tests::{fixture_builder::FixtureBuilder, utils::assert_array_eq} }; @@ -88,10 +88,10 @@ mod tests { pub fn new() -> Self { let mut previous_kernel = FixtureBuilder::new_from_counter(15).as_parent_contract(); let private_call = FixtureBuilder::new_from_counter(200); - let hints = PrivateKernelInnerHints { note_hash_nullifier_counters: [0; MAX_NEW_NOTE_HASHES_PER_CALL] }; + let hints = PrivateKernelInnerHints { note_hash_nullifier_counters: [0; MAX_NOTE_HASHES_PER_CALL] }; // 0th nullifier must be non-zero. - previous_kernel.append_new_nullifiers(1); + previous_kernel.append_nullifiers(1); PrivateKernelInnerInputsBuilder { previous_kernel, private_call, hints } } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_reset.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_reset.nr index e9179e7ce8d..36bde997f1e 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_reset.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_reset.nr @@ -8,7 +8,7 @@ use dep::types::{ note_hash::ScopedNoteHash, nullifier::ScopedNullifier, log_hash::NoteLogHash }, constants::{ - MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, + MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_KEY_VALIDATION_REQUESTS_PER_TX, MAX_ENCRYPTED_LOGS_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX }, @@ -18,14 +18,14 @@ use dep::types::{ // Can just be KernelCircuitPublicInputs. struct PrivateKernelResetOutputs { - note_hashes: [ScopedNoteHash; MAX_NEW_NOTE_HASHES_PER_TX], - nullifiers: [ScopedNullifier; MAX_NEW_NULLIFIERS_PER_TX], + note_hashes: [ScopedNoteHash; MAX_NOTE_HASHES_PER_TX], + nullifiers: [ScopedNullifier; MAX_NULLIFIERS_PER_TX], note_encrypted_log_hashes: [NoteLogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], } struct PrivateKernelResetHints { - transient_nullifier_indexes_for_note_hashes: [u32; MAX_NEW_NOTE_HASHES_PER_TX], - transient_note_hash_indexes_for_nullifiers: [u32; MAX_NEW_NULLIFIERS_PER_TX], + transient_nullifier_indexes_for_note_hashes: [u32; MAX_NOTE_HASHES_PER_TX], + transient_note_hash_indexes_for_nullifiers: [u32; MAX_NULLIFIERS_PER_TX], transient_note_hash_indexes_for_logs: [u32; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], note_hash_read_request_hints: NoteHashReadRequestHints, nullifier_read_request_hints: NullifierReadRequestHints, @@ -48,17 +48,17 @@ impl Self { let mut previous_kernel = FixtureBuilder::new(); - previous_kernel.append_new_nullifiers(1); + previous_kernel.append_nullifiers(1); PrivateKernelResetInputsBuilder { previous_kernel, - transient_nullifier_indexes_for_note_hashes: [MAX_NEW_NULLIFIERS_PER_TX; MAX_NEW_NOTE_HASHES_PER_TX], - transient_note_hash_indexes_for_nullifiers: [MAX_NEW_NOTE_HASHES_PER_TX; MAX_NEW_NULLIFIERS_PER_TX], - transient_note_hash_indexes_for_logs: [MAX_NEW_NOTE_HASHES_PER_TX; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], + transient_nullifier_indexes_for_note_hashes: [MAX_NULLIFIERS_PER_TX; MAX_NOTE_HASHES_PER_TX], + transient_note_hash_indexes_for_nullifiers: [MAX_NOTE_HASHES_PER_TX; MAX_NULLIFIERS_PER_TX], + transient_note_hash_indexes_for_logs: [MAX_NOTE_HASHES_PER_TX; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], note_hash_read_request_hints_builder: NoteHashReadRequestHintsBuilder::new(MAX_NOTE_HASH_READ_REQUESTS_PER_TX), nullifier_read_request_hints_builder: NullifierReadRequestHintsBuilder::new(MAX_NULLIFIER_READ_REQUESTS_PER_TX) } @@ -146,9 +146,9 @@ mod tests { } pub fn nullify_pending_note_hash(&mut self, nullifier_index: u32, note_hash_index: u32) { - let note_hash = self.previous_kernel.new_note_hashes.get(note_hash_index).note_hash; - self.previous_kernel.new_note_hashes.storage[note_hash_index].nullifier_counter = self.previous_kernel.new_nullifiers.get(nullifier_index).counter(); - self.previous_kernel.new_nullifiers.storage[nullifier_index].nullifier.note_hash = note_hash.value; + let note_hash = self.previous_kernel.note_hashes.get(note_hash_index).note_hash; + self.previous_kernel.note_hashes.storage[note_hash_index].nullifier_counter = self.previous_kernel.nullifiers.get(nullifier_index).counter(); + self.previous_kernel.nullifiers.storage[nullifier_index].nullifier.note_hash = note_hash.value; self.transient_nullifier_indexes_for_note_hashes[note_hash_index] = nullifier_index; self.transient_note_hash_indexes_for_nullifiers[nullifier_index] = note_hash_index; for i in 0..self.previous_kernel.note_encrypted_logs_hashes.len() { @@ -162,11 +162,11 @@ mod tests { pub fn execute(&mut self) -> PrivateKernelCircuitPublicInputs { let outputs = PrivateKernelResetOutputs { - note_hashes: squash_transient_note_hashes(self.previous_kernel.new_note_hashes.storage), - nullifiers: squash_transient_nullifiers(self.previous_kernel.new_nullifiers.storage), + note_hashes: squash_transient_note_hashes(self.previous_kernel.note_hashes.storage), + nullifiers: squash_transient_nullifiers(self.previous_kernel.nullifiers.storage), note_encrypted_log_hashes: squash_transient_logs( self.previous_kernel.note_encrypted_logs_hashes.storage, - self.previous_kernel.new_note_hashes.storage + self.previous_kernel.note_hashes.storage ) }; @@ -211,7 +211,7 @@ mod tests { unconstrained fn two_pending_note_hash_read_request() { let mut builder = PrivateKernelResetInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes(3); + builder.previous_kernel.append_note_hashes(3); builder.add_pending_note_hash_read_request(1); builder.add_pending_note_hash_read_request(0); @@ -222,7 +222,7 @@ mod tests { unconstrained fn pending_note_hash_read_request_wrong_hint_fails() { let mut builder = PrivateKernelResetInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes(3); + builder.previous_kernel.append_note_hashes(3); builder.add_pending_note_hash_read_request(1); let mut hint = builder.note_hash_read_request_hints_builder.pending_read_hints.pop(); hint.pending_value_index = 2; @@ -235,7 +235,7 @@ mod tests { unconstrained fn one_pending_nullifier_read_request() { let mut builder = PrivateKernelResetInputsBuilder::new(); - builder.previous_kernel.append_new_nullifiers(3); + builder.previous_kernel.append_nullifiers(3); builder.add_pending_nullifier_read_request(1); builder.succeeded(); @@ -245,7 +245,7 @@ mod tests { unconstrained fn two_pending_nullifier_read_requests() { let mut builder = PrivateKernelResetInputsBuilder::new(); - builder.previous_kernel.append_new_nullifiers(3); + builder.previous_kernel.append_nullifiers(3); builder.add_pending_nullifier_read_request(1); builder.add_pending_nullifier_read_request(0); @@ -256,7 +256,7 @@ mod tests { unconstrained fn pending_nullifier_read_request_wrong_hint_fails() { let mut builder = PrivateKernelResetInputsBuilder::new(); - builder.previous_kernel.append_new_nullifiers(3); + builder.previous_kernel.append_nullifiers(3); builder.add_pending_nullifier_read_request(1); let mut hint = builder.nullifier_read_request_hints_builder.pending_read_hints.pop(); assert(hint.pending_value_index == 2); @@ -270,9 +270,9 @@ mod tests { unconstrained fn pending_nullifier_read_request_reads_before_value_fails() { let mut builder = PrivateKernelResetInputsBuilder::new(); - builder.previous_kernel.append_new_nullifiers(3); + builder.previous_kernel.append_nullifiers(3); builder.add_pending_nullifier_read_request(1); - let nullifier_being_read = builder.previous_kernel.new_nullifiers.storage[2]; + let nullifier_being_read = builder.previous_kernel.nullifiers.storage[2]; let mut read_request = builder.previous_kernel.nullifier_read_requests.pop(); read_request.read_request.counter = nullifier_being_read.counter() - 1; builder.previous_kernel.nullifier_read_requests.push(read_request); @@ -284,8 +284,8 @@ mod tests { unconstrained fn propagates_unverified_requests() { let mut builder = PrivateKernelResetInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes(3); - builder.previous_kernel.append_new_nullifiers(3); + builder.previous_kernel.append_note_hashes(3); + builder.previous_kernel.append_nullifiers(3); builder.add_pending_note_hash_read_request(0); builder.add_pending_nullifier_read_request(1); @@ -311,73 +311,58 @@ mod tests { #[test] unconstrained fn native_squash_one_of_one_transient_matches_works() { let mut builder = PrivateKernelResetInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes_with_logs(1); - builder.previous_kernel.append_new_nullifiers(2); + builder.previous_kernel.append_note_hashes_with_logs(1); + builder.previous_kernel.append_nullifiers(2); // The nullifier at index 1 is nullifying the hash at index 0; builder.nullify_pending_note_hash(1, 0); - let new_nullifiers = builder.previous_kernel.new_nullifiers.storage; + let nullifiers = builder.previous_kernel.nullifiers.storage; let public_inputs = builder.execute(); - assert(is_empty_array(public_inputs.end.new_note_hashes)); + assert(is_empty_array(public_inputs.end.note_hashes)); // The nullifier at index 1 is chopped. - assert( - array_eq( - public_inputs.end.new_nullifiers, - [new_nullifiers[0], new_nullifiers[2]] - ) - ); + assert(array_eq(public_inputs.end.nullifiers, [nullifiers[0], nullifiers[2]])); assert(is_empty_array(public_inputs.end.note_encrypted_logs_hashes)); } #[test] unconstrained fn native_squash_one_of_two_transient_matches_works() { let mut builder = PrivateKernelResetInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes_with_logs(2); - builder.previous_kernel.append_new_nullifiers(2); + builder.previous_kernel.append_note_hashes_with_logs(2); + builder.previous_kernel.append_nullifiers(2); // The nullifier at index 1 is nullifying the hash at index 0; builder.nullify_pending_note_hash(1, 0); - let new_note_hashes = builder.previous_kernel.new_note_hashes.storage; - let new_nullifiers = builder.previous_kernel.new_nullifiers.storage; - let new_note_logs = builder.previous_kernel.note_encrypted_logs_hashes.storage; + let note_hashes = builder.previous_kernel.note_hashes.storage; + let nullifiers = builder.previous_kernel.nullifiers.storage; + let note_logs = builder.previous_kernel.note_encrypted_logs_hashes.storage; let public_inputs = builder.execute(); // The 0th hash is chopped. - assert(array_eq(public_inputs.end.new_note_hashes, [new_note_hashes[1]])); + assert(array_eq(public_inputs.end.note_hashes, [note_hashes[1]])); // The nullifier at index 1 is chopped. - assert( - array_eq( - public_inputs.end.new_nullifiers, - [new_nullifiers[0], new_nullifiers[2]] - ) - ); + assert(array_eq(public_inputs.end.nullifiers, [nullifiers[0], nullifiers[2]])); // The 0th note log is chopped. - assert( - array_eq( - public_inputs.end.note_encrypted_logs_hashes, - [new_note_logs[1]] - ) - ); + assert(array_eq(public_inputs.end.note_encrypted_logs_hashes, [note_logs[1]])); } #[test] unconstrained fn native_squash_two_of_two_transient_matches_works() { let mut builder = PrivateKernelResetInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes_with_logs(2); - builder.previous_kernel.append_new_nullifiers(2); + builder.previous_kernel.append_note_hashes_with_logs(2); + builder.previous_kernel.append_nullifiers(2); // The nullifier at index 1 is nullifying the hash at index 1; builder.nullify_pending_note_hash(1, 1); // The nullifier at index 2 is nullifying the hash at index 0; builder.nullify_pending_note_hash(2, 0); - let new_nullifiers = builder.previous_kernel.new_nullifiers.storage; + let nullifiers = builder.previous_kernel.nullifiers.storage; let public_inputs = builder.execute(); - assert(is_empty_array(public_inputs.end.new_note_hashes)); + assert(is_empty_array(public_inputs.end.note_hashes)); // Only the first nullifier is left after squashing. - assert(array_eq(public_inputs.end.new_nullifiers, [new_nullifiers[0]])); + assert(array_eq(public_inputs.end.nullifiers, [nullifiers[0]])); assert(is_empty_array(public_inputs.end.note_encrypted_logs_hashes)); } @@ -385,19 +370,19 @@ mod tests { unconstrained fn squash_unordered_transient_notes_works() { let mut builder = PrivateKernelResetInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes_with_logs(3); + builder.previous_kernel.append_note_hashes_with_logs(3); // Shuffle the note hashes so they will have to be re-ordered. - let tmp = builder.previous_kernel.new_note_hashes.storage[0]; - builder.previous_kernel.new_note_hashes.storage[0] = builder.previous_kernel.new_note_hashes.storage[1]; - builder.previous_kernel.new_note_hashes.storage[1] = builder.previous_kernel.new_note_hashes.storage[2]; - builder.previous_kernel.new_note_hashes.storage[2] = tmp; + let tmp = builder.previous_kernel.note_hashes.storage[0]; + builder.previous_kernel.note_hashes.storage[0] = builder.previous_kernel.note_hashes.storage[1]; + builder.previous_kernel.note_hashes.storage[1] = builder.previous_kernel.note_hashes.storage[2]; + builder.previous_kernel.note_hashes.storage[2] = tmp; - builder.previous_kernel.append_new_nullifiers(3); + builder.previous_kernel.append_nullifiers(3); // Shuffle the nullifers so they will have to be re-ordered. - let tmp = builder.previous_kernel.new_nullifiers.storage[1]; - builder.previous_kernel.new_nullifiers.storage[1] = builder.previous_kernel.new_nullifiers.storage[3]; - builder.previous_kernel.new_nullifiers.storage[3] = builder.previous_kernel.new_nullifiers.storage[2]; - builder.previous_kernel.new_nullifiers.storage[2] = tmp; + let tmp = builder.previous_kernel.nullifiers.storage[1]; + builder.previous_kernel.nullifiers.storage[1] = builder.previous_kernel.nullifiers.storage[3]; + builder.previous_kernel.nullifiers.storage[3] = builder.previous_kernel.nullifiers.storage[2]; + builder.previous_kernel.nullifiers.storage[2] = tmp; // The nullifier at index 1 is nullifying the note hash at index 1; builder.nullify_pending_note_hash(1, 1); @@ -406,21 +391,21 @@ mod tests { // The nullifier at index 3 is nullifying the note hash at index 0; builder.nullify_pending_note_hash(3, 0); - let new_nullifiers = builder.previous_kernel.new_nullifiers.storage; + let nullifiers = builder.previous_kernel.nullifiers.storage; let public_inputs = builder.execute(); - assert(is_empty_array(public_inputs.end.new_note_hashes)); + assert(is_empty_array(public_inputs.end.note_hashes)); // Only the first nullifier is left after squashing. - assert(array_eq(public_inputs.end.new_nullifiers, [new_nullifiers[0]])); + assert(array_eq(public_inputs.end.nullifiers, [nullifiers[0]])); assert(is_empty_array(public_inputs.end.note_encrypted_logs_hashes)); } #[test(should_fail_with="Value of the hinted transient note hash does not match")] unconstrained fn wrong_transient_nullifier_index_for_note_hash_fails() { let mut builder = PrivateKernelResetInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes(1); - builder.previous_kernel.append_new_nullifiers(1); + builder.previous_kernel.append_note_hashes(1); + builder.previous_kernel.append_nullifiers(1); // The nullifier at index 1 is nullifying the hash at index 0; builder.nullify_pending_note_hash(1, 0); // Change the hint to be out of bounds. @@ -431,8 +416,8 @@ mod tests { #[test(should_fail_with="Invalid transient nullifier index hint")] unconstrained fn wrong_transient_nullifier_index_hint_fails() { let mut builder = PrivateKernelResetInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes(2); - builder.previous_kernel.append_new_nullifiers(2); + builder.previous_kernel.append_note_hashes(2); + builder.previous_kernel.append_nullifiers(2); // The nullifier at index 1 is nullifying the hash at index 1; builder.nullify_pending_note_hash(1, 1); // The nullifier at index 2 is nullifying the hash at index 0; diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail.nr index 149b0187d94..f21f036f67e 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail.nr @@ -71,7 +71,7 @@ mod tests { // note_hashes for the given note_hashes. pub fn compute_output_note_hashes(self, note_hashes: [ScopedNoteHash; N]) -> [Field; N] { // First nullifier is tx hash. - let tx_hash = self.previous_kernel.new_nullifiers.get_unchecked(0).value(); + let tx_hash = self.previous_kernel.nullifiers.get_unchecked(0).value(); let mut output = [0; N]; for i in 0..N { output[i] = silo_note_hash(note_hashes[i], tx_hash, i); @@ -229,41 +229,41 @@ mod tests { fn ordering_of_note_hashes_and_nullifiers() { let mut builder = PrivateKernelTailInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes(10); - builder.previous_kernel.append_new_nullifiers(10); + builder.previous_kernel.append_note_hashes(10); + builder.previous_kernel.append_nullifiers(10); - let sorted_note_hashes = builder.previous_kernel.new_note_hashes.storage; - let sorted_nullifiers = builder.previous_kernel.new_nullifiers.storage; + let sorted_note_hashes = builder.previous_kernel.note_hashes.storage; + let sorted_nullifiers = builder.previous_kernel.nullifiers.storage; let mut reversed_note_hashes = [ScopedNoteHash::empty(); 10]; let mut reversed_nullifiers = [ScopedNullifier::empty(); 10]; for i in 0..10 { - reversed_note_hashes[9 - i] = builder.previous_kernel.new_note_hashes.pop(); - reversed_nullifiers[9 - i] = builder.previous_kernel.new_nullifiers.pop(); + reversed_note_hashes[9 - i] = builder.previous_kernel.note_hashes.pop(); + reversed_nullifiers[9 - i] = builder.previous_kernel.nullifiers.pop(); } - builder.previous_kernel.new_note_hashes.extend_from_array(reversed_note_hashes); - builder.previous_kernel.new_nullifiers.extend_from_array(reversed_nullifiers); + builder.previous_kernel.note_hashes.extend_from_array(reversed_note_hashes); + builder.previous_kernel.nullifiers.extend_from_array(reversed_nullifiers); let public_inputs = builder.execute(); let expected_note_hashes = builder.compute_output_note_hashes(sorted_note_hashes); let expected_nullifiers = builder.compute_output_nullifiers(sorted_nullifiers); for i in 0..10 { - assert(public_inputs.end.new_note_hashes[i].eq(expected_note_hashes[i])); - assert(public_inputs.end.new_nullifiers[i].eq(expected_nullifiers[i])); + assert(public_inputs.end.note_hashes[i].eq(expected_note_hashes[i])); + assert(public_inputs.end.nullifiers[i].eq(expected_nullifiers[i])); } } #[test] fn native_empty_nullified_note_hash_means_persistent_nullifier_0() { let mut builder = PrivateKernelTailInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes(2); - builder.previous_kernel.append_new_nullifiers(2); + builder.previous_kernel.append_note_hashes(2); + builder.previous_kernel.append_nullifiers(2); let public_inputs = builder.execute(); - assert_eq(array_length(public_inputs.end.new_note_hashes), 2); - assert_eq(array_length(public_inputs.end.new_nullifiers), 3); + assert_eq(array_length(public_inputs.end.note_hashes), 2); + assert_eq(array_length(public_inputs.end.nullifiers), 3); let expected_gas = Gas::tx_overhead() + Gas::new(DA_GAS_PER_BYTE * DA_BYTES_PER_FIELD * 5, 0); assert_eq(public_inputs.end.gas_used, expected_gas); } @@ -292,7 +292,7 @@ mod tests { #[test(should_fail_with="Non empty note hash read requests")] fn non_empty_note_hash_read_requests() { let mut builder = PrivateKernelTailInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes(3); + builder.previous_kernel.append_note_hashes(3); let _void = builder.previous_kernel.add_read_request_for_pending_note_hash(1); builder.failed(); } @@ -300,7 +300,7 @@ mod tests { #[test(should_fail_with="Non empty nullifier read requests")] fn non_empty_nullifier_read_requests() { let mut builder = PrivateKernelTailInputsBuilder::new(); - builder.previous_kernel.append_new_nullifiers(3); + builder.previous_kernel.append_nullifiers(3); let _void = builder.previous_kernel.add_read_request_for_pending_nullifier(1); builder.failed(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail_to_public.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail_to_public.nr index 0b423767d07..3f00cfe4974 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail_to_public.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail_to_public.nr @@ -66,7 +66,7 @@ mod tests { // note_hashes for the given note_hashes. pub fn compute_output_note_hashes(self, note_hashes: [ScopedNoteHash; N]) -> [NoteHash; N] { // First nullifier is tx hash. - let tx_hash = self.previous_kernel.new_nullifiers.get_unchecked(0).value(); + let tx_hash = self.previous_kernel.nullifiers.get_unchecked(0).value(); let mut output = [NoteHash::empty(); N]; for i in 0..N { output[i] = NoteHash { @@ -114,32 +114,32 @@ mod tests { fn ordering_of_note_hashes_and_nullifiers() { let mut builder = PrivateKernelTailToPublicInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes(10); - builder.previous_kernel.append_new_nullifiers(10); + builder.previous_kernel.append_note_hashes(10); + builder.previous_kernel.append_nullifiers(10); - let sorted_note_hashes = builder.previous_kernel.new_note_hashes.storage; - let sorted_nullifiers = builder.previous_kernel.new_nullifiers.storage; + let sorted_note_hashes = builder.previous_kernel.note_hashes.storage; + let sorted_nullifiers = builder.previous_kernel.nullifiers.storage; let mut reversed_note_hashes = [ScopedNoteHash::empty(); 10]; let mut reversed_nullifiers = [ScopedNullifier::empty(); 10]; for i in 0..10 { - reversed_note_hashes[9 - i] = builder.previous_kernel.new_note_hashes.pop(); - reversed_nullifiers[9 - i] = builder.previous_kernel.new_nullifiers.pop(); + reversed_note_hashes[9 - i] = builder.previous_kernel.note_hashes.pop(); + reversed_nullifiers[9 - i] = builder.previous_kernel.nullifiers.pop(); } - builder.previous_kernel.new_note_hashes.extend_from_array(reversed_note_hashes); - builder.previous_kernel.new_nullifiers.extend_from_array(reversed_nullifiers); + builder.previous_kernel.note_hashes.extend_from_array(reversed_note_hashes); + builder.previous_kernel.nullifiers.extend_from_array(reversed_nullifiers); let public_inputs = builder.execute(); - let first_nullifier = builder.previous_kernel.new_nullifiers.get(0); - assert_eq(public_inputs.end_non_revertible.new_nullifiers[0], first_nullifier.nullifier); + let first_nullifier = builder.previous_kernel.nullifiers.get(0); + assert_eq(public_inputs.end_non_revertible.nullifiers[0], first_nullifier.nullifier); let output_note_hashes = builder.compute_output_note_hashes(sorted_note_hashes); let output_nullifiers = builder.compute_output_nullifiers(sorted_nullifiers); for i in 0..10 { - assert(public_inputs.end.new_note_hashes[i].eq(output_note_hashes[i])); - assert(public_inputs.end.new_nullifiers[i].eq(output_nullifiers[i + 1])); + assert(public_inputs.end.note_hashes[i].eq(output_note_hashes[i])); + assert(public_inputs.end.nullifiers[i].eq(output_nullifiers[i + 1])); } } @@ -170,27 +170,27 @@ mod tests { fn split_nullifiers_into_non_revertible() { let mut builder = PrivateKernelTailToPublicInputsBuilder::new(); // expect 3 non-revertible nullifiers: the tx nullifier + 2 new ones - builder.previous_kernel.append_new_nullifiers(2); + builder.previous_kernel.append_nullifiers(2); builder.previous_kernel.end_setup(); // expect 2 revertible nullifiers - builder.previous_kernel.append_new_nullifiers(2); + builder.previous_kernel.append_nullifiers(2); - let new_nullifiers = builder.previous_kernel.new_nullifiers.storage; + let nullifiers = builder.previous_kernel.nullifiers.storage; let public_inputs = builder.execute(); - let output_nullifiers = builder.compute_output_nullifiers(new_nullifiers); + let output_nullifiers = builder.compute_output_nullifiers(nullifiers); assert( array_eq( - public_inputs.end_non_revertible.new_nullifiers, + public_inputs.end_non_revertible.nullifiers, [output_nullifiers[0], output_nullifiers[1], output_nullifiers[2]] ) ); assert( array_eq( - public_inputs.end.new_nullifiers, + public_inputs.end.nullifiers, [output_nullifiers[3], output_nullifiers[4]] ) ); @@ -206,22 +206,22 @@ mod tests { let mut builder = PrivateKernelTailToPublicInputsBuilder::new(); // expect 2 non-revertible note hashes - builder.previous_kernel.append_new_note_hashes_with_logs(2); + builder.previous_kernel.append_note_hashes_with_logs(2); builder.previous_kernel.end_setup(); // expect 2 revertible note hashes - builder.previous_kernel.append_new_note_hashes_with_logs(2); + builder.previous_kernel.append_note_hashes_with_logs(2); - let new_note_hashes = builder.previous_kernel.new_note_hashes.storage; - let new_note_logs = builder.previous_kernel.note_encrypted_logs_hashes.storage; + let note_hashes = builder.previous_kernel.note_hashes.storage; + let note_logs = builder.previous_kernel.note_encrypted_logs_hashes.storage; let public_inputs = builder.execute(); - let siloed_note_hashes = builder.compute_output_note_hashes(new_note_hashes); - let public_note_logs = builder.compute_output_note_logs(new_note_logs); + let siloed_note_hashes = builder.compute_output_note_hashes(note_hashes); + let public_note_logs = builder.compute_output_note_logs(note_logs); assert( array_eq( - public_inputs.end_non_revertible.new_note_hashes, + public_inputs.end_non_revertible.note_hashes, [siloed_note_hashes[0], siloed_note_hashes[1]] ) ); @@ -235,7 +235,7 @@ mod tests { assert( array_eq( - public_inputs.end.new_note_hashes, + public_inputs.end.note_hashes, [siloed_note_hashes[2], siloed_note_hashes[3]] ) ); @@ -247,8 +247,8 @@ mod tests { ) ); - let revertible_logs_len = (new_note_logs[2].length + new_note_logs[3].length) as u32; - let non_revertible_logs_len = (new_note_logs[0].length + new_note_logs[1].length) as u32; + let revertible_logs_len = (note_logs[2].length + note_logs[3].length) as u32; + let non_revertible_logs_len = (note_logs[0].length + note_logs[1].length) as u32; assert_eq( public_inputs.end.gas_used, Gas::new( @@ -268,7 +268,7 @@ mod tests { #[test(should_fail_with="Non empty note hash read requests")] fn non_empty_note_hash_read_requests() { let mut builder = PrivateKernelTailToPublicInputsBuilder::new(); - builder.previous_kernel.append_new_note_hashes(3); + builder.previous_kernel.append_note_hashes(3); let _void = builder.previous_kernel.add_read_request_for_pending_note_hash(1); builder.failed(); } @@ -276,7 +276,7 @@ mod tests { #[test(should_fail_with="Non empty nullifier read requests")] fn non_empty_nullifier_read_requests() { let mut builder = PrivateKernelTailToPublicInputsBuilder::new(); - builder.previous_kernel.append_new_nullifiers(3); + builder.previous_kernel.append_nullifiers(3); let _void = builder.previous_kernel.add_read_request_for_pending_nullifier(1); builder.failed(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/mod.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/mod.nr index 2c57be0cfee..06e4ad419a2 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/mod.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/mod.nr @@ -46,7 +46,7 @@ impl PrivateCallDataValidatorBuilder { pub fn validate(self) { let private_call = self.private_call.to_private_call_data(); let mut accumulated_note_hashes = self.previous_note_hashes; - accumulated_note_hashes.extend_from_bounded_vec(self.private_call.new_note_hashes); + accumulated_note_hashes.extend_from_bounded_vec(self.private_call.note_hashes); PrivateCallDataValidator::new(private_call).validate(accumulated_note_hashes.storage); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_arrays.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_arrays.nr index 01796cafa0c..e601fc98569 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_arrays.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_arrays.nr @@ -42,8 +42,8 @@ fn validate_arrays_malformed_key_validation_requests_fails() { fn validate_arrays_malformed_note_hashes_fails() { let mut builder = PrivateCallDataValidatorBuilder::new(); - builder.private_call.append_new_note_hashes(1); - unshift_empty_item(&mut builder.private_call.new_note_hashes); + builder.private_call.append_note_hashes(1); + unshift_empty_item(&mut builder.private_call.note_hashes); builder.validate(); } @@ -52,8 +52,8 @@ fn validate_arrays_malformed_note_hashes_fails() { fn validate_arrays_malformed_nullifiers_fails() { let mut builder = PrivateCallDataValidatorBuilder::new(); - builder.private_call.append_new_nullifiers(1); - unshift_empty_item(&mut builder.private_call.new_nullifiers); + builder.private_call.append_nullifiers(1); + unshift_empty_item(&mut builder.private_call.nullifiers); builder.validate(); } @@ -62,8 +62,8 @@ fn validate_arrays_malformed_nullifiers_fails() { fn validate_arrays_malformed_l2_to_l1_msgs_fails() { let mut builder = PrivateCallDataValidatorBuilder::new(); - builder.private_call.append_new_l2_to_l1_msgs(1); - unshift_empty_item(&mut builder.private_call.new_l2_to_l1_msgs); + builder.private_call.append_l2_to_l1_msgs(1); + unshift_empty_item(&mut builder.private_call.l2_to_l1_msgs); builder.validate(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_call.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_call.nr index a17eeef9d53..45e332bb239 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_call.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_call.nr @@ -54,29 +54,29 @@ fn validate_call_is_static_mismatch_storage_contract_fails() { builder.validate(); } -#[test(should_fail_with="new_note_hashes must be empty for static calls")] +#[test(should_fail_with="note_hashes must be empty for static calls")] fn validate_call_is_static_creating_note_hashes_fails() { let mut builder = PrivateCallDataValidatorBuilder::new().is_static_call(); - builder.private_call.append_new_note_hashes(1); + builder.private_call.append_note_hashes(1); builder.validate(); } -#[test(should_fail_with="new_nullifiers must be empty for static calls")] +#[test(should_fail_with="nullifiers must be empty for static calls")] fn validate_call_is_static_creating_nullifiers_fails() { let mut builder = PrivateCallDataValidatorBuilder::new().is_static_call(); - builder.private_call.append_new_nullifiers(1); + builder.private_call.append_nullifiers(1); builder.validate(); } -#[test(should_fail_with="new_l2_to_l1_msgs must be empty for static calls")] +#[test(should_fail_with="l2_to_l1_msgs must be empty for static calls")] fn validate_call_is_static_creating_l2_to_l1_msgs_fails() { let mut builder = PrivateCallDataValidatorBuilder::new().is_static_call(); - builder.private_call.append_new_l2_to_l1_msgs(1); + builder.private_call.append_l2_to_l1_msgs(1); builder.validate(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_counters.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_counters.nr index 2f85c7df52f..02ef4c181a8 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_counters.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_counters.nr @@ -42,7 +42,7 @@ fn validate_counters_private_call_negative_call_counter_range_fails() { fn validate_counters_note_hashes_succeeds() { let mut builder = PrivateCallDataValidatorBuilder::new(); - builder.private_call.append_new_note_hashes(2); + builder.private_call.append_note_hashes(2); builder.validate(); } @@ -51,9 +51,9 @@ fn validate_counters_note_hashes_succeeds() { fn validate_counters_note_hash_counter_same_as_call_counter_start_fails() { let mut builder = PrivateCallDataValidatorBuilder::new(); - builder.private_call.append_new_note_hashes(1); + builder.private_call.append_note_hashes(1); // Tweak the counter of the first note hash to EQUAL the start counter of the call. - builder.private_call.new_note_hashes.storage[0].note_hash.counter = builder.private_call.counter_start; + builder.private_call.note_hashes.storage[0].note_hash.counter = builder.private_call.counter_start; builder.validate(); } @@ -62,9 +62,9 @@ fn validate_counters_note_hash_counter_same_as_call_counter_start_fails() { fn validate_counters_note_hash_counter_smaller_than_call_fails() { let mut builder = PrivateCallDataValidatorBuilder::new(); - builder.private_call.append_new_note_hashes(1); + builder.private_call.append_note_hashes(1); // Tweak the counter of the first note hash to be LESS than the start counter of the call. - builder.private_call.new_note_hashes.storage[0].note_hash.counter = builder.private_call.counter_start - 1; + builder.private_call.note_hashes.storage[0].note_hash.counter = builder.private_call.counter_start - 1; builder.validate(); } @@ -73,11 +73,11 @@ fn validate_counters_note_hash_counter_smaller_than_call_fails() { fn validate_counters_note_hash_identical_counters_fails() { let mut builder = PrivateCallDataValidatorBuilder::new(); - builder.private_call.append_new_note_hashes(2); + builder.private_call.append_note_hashes(2); let counter_start = builder.private_call.counter_start; // Tweak the counter of the second note hash to EQUAL the counter of the first note hash. - builder.private_call.new_note_hashes.storage[0].note_hash.counter = counter_start + 1; - builder.private_call.new_note_hashes.storage[1].note_hash.counter = counter_start + 1; + builder.private_call.note_hashes.storage[0].note_hash.counter = counter_start + 1; + builder.private_call.note_hashes.storage[1].note_hash.counter = counter_start + 1; builder.validate(); } @@ -86,11 +86,11 @@ fn validate_counters_note_hash_identical_counters_fails() { fn validate_counters_note_hash_unordered_counters_fails() { let mut builder = PrivateCallDataValidatorBuilder::new(); - builder.private_call.append_new_note_hashes(2); + builder.private_call.append_note_hashes(2); let counter_start = builder.private_call.counter_start; // Tweak the counter of the second note hash to be LESS than the counter of the first note hash. - builder.private_call.new_note_hashes.storage[0].note_hash.counter = counter_start + 2; - builder.private_call.new_note_hashes.storage[1].note_hash.counter = counter_start + 1; + builder.private_call.note_hashes.storage[0].note_hash.counter = counter_start + 2; + builder.private_call.note_hashes.storage[1].note_hash.counter = counter_start + 1; builder.validate(); } @@ -99,9 +99,9 @@ fn validate_counters_note_hash_unordered_counters_fails() { fn validate_counters_note_hash_counter_larger_than_call_fails() { let mut builder = PrivateCallDataValidatorBuilder::new(); - builder.private_call.append_new_note_hashes(2); + builder.private_call.append_note_hashes(2); // Tweak the counter of the second note hash to be GREATER than the end counter of the call. - builder.private_call.new_note_hashes.storage[1].note_hash.counter = builder.private_call.counter + 1; + builder.private_call.note_hashes.storage[1].note_hash.counter = builder.private_call.counter + 1; builder.validate(); } @@ -110,9 +110,9 @@ fn validate_counters_note_hash_counter_larger_than_call_fails() { fn validate_counters_note_hash_counter_same_as_call_counter_end_fails() { let mut builder = PrivateCallDataValidatorBuilder::new(); - builder.private_call.append_new_note_hashes(2); + builder.private_call.append_note_hashes(2); // Tweak the counter of the second note hash to EQUAL the end counter of the call. - builder.private_call.new_note_hashes.storage[1].note_hash.counter = builder.private_call.counter; + builder.private_call.note_hashes.storage[1].note_hash.counter = builder.private_call.counter; builder.validate(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_note_logs.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_note_logs.nr index 958157529fd..45e3436b12b 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_note_logs.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_note_logs.nr @@ -5,7 +5,7 @@ use dep::types::{abis::note_hash::NoteHash, address::AztecAddress}; fn validate_note_logs_succeeds() { let mut builder = PrivateCallDataValidatorBuilder::new(); - builder.private_call.append_new_note_hashes_with_logs(2); + builder.private_call.append_note_hashes_with_logs(2); builder.validate(); } @@ -14,7 +14,7 @@ fn validate_note_logs_succeeds() { fn validate_note_logs_random_note_hash_counter_fails() { let mut builder = PrivateCallDataValidatorBuilder::new(); - builder.private_call.append_new_note_hashes_with_logs(2); + builder.private_call.append_note_hashes_with_logs(2); // Tweak the note_hash_counter to not match any note hash's counter. builder.private_call.note_encrypted_logs_hashes.storage[1].note_hash_counter += 100; @@ -25,7 +25,7 @@ fn validate_note_logs_random_note_hash_counter_fails() { fn validate_note_logs_zero_note_hash_counter_fails() { let mut builder = PrivateCallDataValidatorBuilder::new(); - builder.private_call.append_new_note_hashes_with_logs(2); + builder.private_call.append_note_hashes_with_logs(2); // Tweak the note_hash_counter to be 0. builder.private_call.note_encrypted_logs_hashes.storage[1].note_hash_counter = 0; diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/mod.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/mod.nr index d52c6cf82b1..c80c105734b 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/mod.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/mod.nr @@ -15,14 +15,14 @@ use dep::types::{ kernel_circuit_public_inputs::PrivateKernelCircuitPublicInputsArrayLengths, private_circuit_public_inputs::PrivateCircuitPublicInputsArrayLengths }, - constants::MAX_NEW_NOTE_HASHES_PER_CALL, tests::{fixture_builder::FixtureBuilder}, + constants::MAX_NOTE_HASHES_PER_CALL, tests::{fixture_builder::FixtureBuilder}, transaction::tx_request::TxRequest }; struct PrivateKernelCircuitOutputValidatorBuilder { previous_kernel: FixtureBuilder, private_call: FixtureBuilder, - note_hash_nullifier_counters: [u32; MAX_NEW_NOTE_HASHES_PER_CALL], + note_hash_nullifier_counters: [u32; MAX_NOTE_HASHES_PER_CALL], output: FixtureBuilder, tx_request: TxRequest, } @@ -31,12 +31,12 @@ impl PrivateKernelCircuitOutputValidatorBuilder { pub fn new() -> Self { let mut previous_kernel = FixtureBuilder::new(); let private_call = FixtureBuilder::new(); - let note_hash_nullifier_counters = [0; MAX_NEW_NOTE_HASHES_PER_CALL]; + let note_hash_nullifier_counters = [0; MAX_NOTE_HASHES_PER_CALL]; let mut output = FixtureBuilder::new(); let tx_request = output.build_tx_request(); let first_nullifier = create_first_nullifier(tx_request); - output.new_nullifiers.push(first_nullifier); - previous_kernel.new_nullifiers.push(first_nullifier); + output.nullifiers.push(first_nullifier); + previous_kernel.nullifiers.push(first_nullifier); PrivateKernelCircuitOutputValidatorBuilder { previous_kernel, private_call, note_hash_nullifier_counters, output, tx_request } } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_initial_values.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_initial_values.nr index 335a0532056..63cd2b9e879 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_initial_values.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_initial_values.nr @@ -46,7 +46,7 @@ fn validate_initial_values_constants_non_empty_global_variables_fails() { fn validate_initial_values_constants_incorrect_first_nullifier_fails() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.output.new_nullifiers.storage[0].nullifier.value += 1; + builder.output.nullifiers.storage[0].nullifier.value += 1; builder.validate_as_first_call(); } @@ -55,7 +55,7 @@ fn validate_initial_values_constants_incorrect_first_nullifier_fails() { fn validate_initial_values_constants_empty_first_nullifier_fails() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.output.new_nullifiers = BoundedVec::new(); + builder.output.nullifiers = BoundedVec::new(); builder.validate_as_first_call(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_propagated_from_previous_kernel.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_propagated_from_previous_kernel.nr index de27661df47..7a1ea86602a 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_propagated_from_previous_kernel.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_propagated_from_previous_kernel.nr @@ -113,76 +113,76 @@ fn validate_propagated_from_previous_kernel_key_validation_requests_less_than_fa } /** - * new_note_hashes + * note_hashes */ #[test] -fn validate_propagated_from_previous_kernel_new_note_hashes_succeeds() { +fn validate_propagated_from_previous_kernel_note_hashes_succeeds() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_note_hashes(2); - builder.output.append_new_note_hashes(2); + builder.previous_kernel.append_note_hashes(2); + builder.output.append_note_hashes(2); builder.validate_as_inner_call(); } #[test(should_fail_with="source item does not prepend to dest")] -fn validate_propagated_from_previous_kernel_new_note_hashes_less_than_fails() { +fn validate_propagated_from_previous_kernel_note_hashes_less_than_fails() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_note_hashes(2); + builder.previous_kernel.append_note_hashes(2); // Propagate 1 less item to the output. - builder.output.append_new_note_hashes(1); + builder.output.append_note_hashes(1); builder.validate_as_inner_call(); } /** - * new_nullifiers + * nullifiers */ #[test] -fn validate_propagated_from_previous_kernel_new_nullifiers_succeeds() { +fn validate_propagated_from_previous_kernel_nullifiers_succeeds() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_nullifiers(2); - builder.output.append_new_nullifiers(2); + builder.previous_kernel.append_nullifiers(2); + builder.output.append_nullifiers(2); builder.validate_as_inner_call(); } #[test(should_fail_with="source item does not prepend to dest")] -fn validate_propagated_from_previous_kernel_new_nullifiers_less_than_fails() { +fn validate_propagated_from_previous_kernel_nullifiers_less_than_fails() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_nullifiers(2); + builder.previous_kernel.append_nullifiers(2); // Propagate 1 less item to the output. - builder.output.append_new_nullifiers(1); + builder.output.append_nullifiers(1); builder.validate_as_inner_call(); } /** - * new_l2_to_l1_msgs + * l2_to_l1_msgs */ #[test] -fn validate_propagated_from_previous_kernel_new_l2_to_l1_msgs_succeeds() { +fn validate_propagated_from_previous_kernel_l2_to_l1_msgs_succeeds() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_l2_to_l1_msgs(2); - builder.output.append_new_l2_to_l1_msgs(2); + builder.previous_kernel.append_l2_to_l1_msgs(2); + builder.output.append_l2_to_l1_msgs(2); builder.validate_as_inner_call(); } #[test(should_fail_with="source item does not prepend to dest")] -fn validate_propagated_from_previous_kernel_new_l2_to_l1_msgs_less_than_fails() { +fn validate_propagated_from_previous_kernel_l2_to_l1_msgs_less_than_fails() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_l2_to_l1_msgs(2); + builder.previous_kernel.append_l2_to_l1_msgs(2); // Propagate 1 less item to the output. - builder.output.append_new_l2_to_l1_msgs(1); + builder.output.append_l2_to_l1_msgs(1); builder.validate_as_inner_call(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_propagated_from_private_call.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_propagated_from_private_call.nr index 710714c5756..68a4e5f1fff 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_propagated_from_private_call.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_propagated_from_private_call.nr @@ -235,41 +235,41 @@ fn validate_propagated_from_private_call_key_validation_requests_output_one_more } /** - * new_note_hashes + * note_hashes */ #[test] -fn validate_propagated_from_private_call_new_note_hashes_succeeds() { +fn validate_propagated_from_private_call_note_hashes_succeeds() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.private_call.append_new_note_hashes(2); - builder.output.append_new_note_hashes(2); + builder.private_call.append_note_hashes(2); + builder.output.append_note_hashes(2); builder.validate_as_inner_call(); } #[test(should_fail_with="output should be appended with empty items")] -fn validate_propagated_from_private_call_new_note_hashes_output_one_more_fails() { +fn validate_propagated_from_private_call_note_hashes_output_one_more_fails() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.private_call.append_new_note_hashes(2); + builder.private_call.append_note_hashes(2); // Propagate 1 more item to the output. - builder.output.append_new_note_hashes(3); + builder.output.append_note_hashes(3); builder.validate_as_inner_call(); } /** - * new_note_hashes + * note_hashes * With nullifier counters. */ #[test] -fn validate_propagated_from_private_call_new_note_hashes_non_zero_nullifier_counters_succeeds() { +fn validate_propagated_from_private_call_note_hashes_non_zero_nullifier_counters_succeeds() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.private_call.append_new_note_hashes(2); - let note_hashes = [builder.private_call.new_note_hashes.storage[0], builder.private_call.new_note_hashes.storage[1]]; + builder.private_call.append_note_hashes(2); + let note_hashes = [builder.private_call.note_hashes.storage[0], builder.private_call.note_hashes.storage[1]]; builder.note_hash_nullifier_counters[0] = note_hashes[0].counter() + 10; builder.note_hash_nullifier_counters[1] = note_hashes[1].counter() + 35; builder.output.add_new_note_hash( @@ -285,15 +285,15 @@ fn validate_propagated_from_private_call_new_note_hashes_non_zero_nullifier_coun } #[test] -fn validate_propagated_from_private_call_new_note_hashes_with_previous_non_zero_nullifier_counters_succeeds() { +fn validate_propagated_from_private_call_note_hashes_with_previous_non_zero_nullifier_counters_succeeds() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_note_hashes(2); - builder.output.append_new_note_hashes(2); + builder.previous_kernel.append_note_hashes(2); + builder.output.append_note_hashes(2); builder.offset_values(2); // Offset the first 2 note hashes. - builder.private_call.append_new_note_hashes(2); - let note_hashes = [builder.private_call.new_note_hashes.storage[0], builder.private_call.new_note_hashes.storage[1]]; + builder.private_call.append_note_hashes(2); + let note_hashes = [builder.private_call.note_hashes.storage[0], builder.private_call.note_hashes.storage[1]]; builder.note_hash_nullifier_counters[0] = note_hashes[0].counter() + 10; builder.note_hash_nullifier_counters[1] = note_hashes[1].counter() + 35; builder.output.add_new_note_hash( @@ -309,11 +309,11 @@ fn validate_propagated_from_private_call_new_note_hashes_with_previous_non_zero_ } #[test(should_fail_with="invalid nullifier counter")] -fn validate_propagated_from_private_call_new_note_hashes_nullifier_counters_too_small_fails() { +fn validate_propagated_from_private_call_note_hashes_nullifier_counters_too_small_fails() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.private_call.append_new_note_hashes(2); - let note_hashes = [builder.private_call.new_note_hashes.storage[0], builder.private_call.new_note_hashes.storage[1]]; + builder.private_call.append_note_hashes(2); + let note_hashes = [builder.private_call.note_hashes.storage[0], builder.private_call.note_hashes.storage[1]]; builder.note_hash_nullifier_counters[0] = note_hashes[0].counter() + 10; // Tweak the nullifier counter to be less than the counter of the note hash. builder.note_hash_nullifier_counters[1] = note_hashes[1].counter() - 1; @@ -330,11 +330,11 @@ fn validate_propagated_from_private_call_new_note_hashes_nullifier_counters_too_ } #[test(should_fail_with="incorrect nullifier counter assigned to dest")] -fn validate_propagated_from_private_call_new_note_hashes_nullifier_counters_mismatch_fails() { +fn validate_propagated_from_private_call_note_hashes_nullifier_counters_mismatch_fails() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.private_call.append_new_note_hashes(2); - let note_hashes = [builder.private_call.new_note_hashes.storage[0], builder.private_call.new_note_hashes.storage[1]]; + builder.private_call.append_note_hashes(2); + let note_hashes = [builder.private_call.note_hashes.storage[0], builder.private_call.note_hashes.storage[1]]; builder.note_hash_nullifier_counters[0] = note_hashes[0].counter() + 10; builder.note_hash_nullifier_counters[1] = note_hashes[1].counter() + 35; builder.output.add_new_note_hash( @@ -351,53 +351,53 @@ fn validate_propagated_from_private_call_new_note_hashes_nullifier_counters_mism } /** - * new_nullifiers + * nullifiers */ #[test] -fn validate_propagated_from_private_call_new_nullifiers_succeeds() { +fn validate_propagated_from_private_call_nullifiers_succeeds() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); builder.offset_values(1); // Offset the first nullifier. - builder.private_call.append_new_nullifiers(2); - builder.output.append_new_nullifiers(2); + builder.private_call.append_nullifiers(2); + builder.output.append_nullifiers(2); builder.validate_as_inner_call(); } #[test(should_fail_with="output should be appended with empty items")] -fn validate_propagated_from_private_call_new_nullifiers_output_one_more_fails() { +fn validate_propagated_from_private_call_nullifiers_output_one_more_fails() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); builder.offset_values(1); // Offset the first nullifier. - builder.private_call.append_new_nullifiers(2); + builder.private_call.append_nullifiers(2); // Propagate 1 more item to the output. - builder.output.append_new_nullifiers(3); + builder.output.append_nullifiers(3); builder.validate_as_inner_call(); } /** - * new_l2_to_l1_msgs + * l2_to_l1_msgs */ #[test] -fn validate_propagated_from_private_call_new_l2_to_l1_msgs_succeeds() { +fn validate_propagated_from_private_call_l2_to_l1_msgs_succeeds() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.private_call.append_new_l2_to_l1_msgs(2); - builder.output.append_new_l2_to_l1_msgs(2); + builder.private_call.append_l2_to_l1_msgs(2); + builder.output.append_l2_to_l1_msgs(2); builder.validate_as_inner_call(); } #[test(should_fail_with="output should be appended with empty items")] -fn validate_propagated_from_private_call_new_l2_to_l1_msgs_output_one_more_fails() { +fn validate_propagated_from_private_call_l2_to_l1_msgs_output_one_more_fails() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.private_call.append_new_l2_to_l1_msgs(1); + builder.private_call.append_l2_to_l1_msgs(1); // Propagate 1 more item to the output. - builder.output.append_new_l2_to_l1_msgs(2); + builder.output.append_l2_to_l1_msgs(2); builder.validate_as_inner_call(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/mod.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/mod.nr index 6a41dba5af6..294c109dff2 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/mod.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/mod.nr @@ -8,7 +8,7 @@ use dep::types::{ kernel_circuit_public_inputs::PrivateKernelCircuitPublicInputs, private_call_request::ScopedPrivateCallRequest }, - constants::MAX_NEW_NOTE_HASHES_PER_CALL, tests::fixture_builder::FixtureBuilder, + constants::MAX_NOTE_HASHES_PER_CALL, tests::fixture_builder::FixtureBuilder, transaction::tx_request::TxRequest }; @@ -16,7 +16,7 @@ struct PrivateKernelCircuitPublicInputsComposerBuilder { tx_request: TxRequest, previous_kernel: FixtureBuilder, private_call: FixtureBuilder, - note_hash_nullifier_counters: [u32; MAX_NEW_NOTE_HASHES_PER_CALL], + note_hash_nullifier_counters: [u32; MAX_NOTE_HASHES_PER_CALL], } impl PrivateKernelCircuitPublicInputsComposerBuilder { @@ -28,7 +28,7 @@ impl PrivateKernelCircuitPublicInputsComposerBuilder { private_call.value_offset = 9999; let tx_request = private_call.build_tx_request(); - let note_hash_nullifier_counters = [0; MAX_NEW_NOTE_HASHES_PER_CALL]; + let note_hash_nullifier_counters = [0; MAX_NOTE_HASHES_PER_CALL]; PrivateKernelCircuitPublicInputsComposerBuilder { tx_request, previous_kernel, private_call, note_hash_nullifier_counters } } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/new_from_previous_kernel_with_private_call.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/new_from_previous_kernel_with_private_call.nr index eb2421ac767..0256b705f12 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/new_from_previous_kernel_with_private_call.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/new_from_previous_kernel_with_private_call.nr @@ -149,30 +149,27 @@ fn new_from_previous_kernel_with_private_call_key_validation_requests_succeeds() } #[test] -fn new_from_previous_kernel_with_private_call_new_note_hashes_succeeds() { +fn new_from_previous_kernel_with_private_call_note_hashes_succeeds() { let mut builder = PrivateKernelCircuitPublicInputsComposerBuilder::new(); - builder.previous_kernel.append_new_note_hashes(2); - let prev = builder.previous_kernel.new_note_hashes.storage; - builder.private_call.append_new_note_hashes(2); - let curr = builder.private_call.new_note_hashes.storage; + builder.previous_kernel.append_note_hashes(2); + let prev = builder.previous_kernel.note_hashes.storage; + builder.private_call.append_note_hashes(2); + let curr = builder.private_call.note_hashes.storage; let output = builder.compose_from_previous_kernel(); - assert_array_eq( - output.end.new_note_hashes, - [prev[0], prev[1], curr[0], curr[1]] - ); + assert_array_eq(output.end.note_hashes, [prev[0], prev[1], curr[0], curr[1]]); } #[test] -fn new_from_previous_kernel_with_private_call_new_note_hashes_with_nullifier_counters_succeeds() { +fn new_from_previous_kernel_with_private_call_note_hashes_with_nullifier_counters_succeeds() { let mut builder = PrivateKernelCircuitPublicInputsComposerBuilder::new(); - builder.previous_kernel.append_new_note_hashes(2); - let prev = builder.previous_kernel.new_note_hashes.storage; - builder.private_call.append_new_note_hashes(2); - let mut curr = builder.private_call.new_note_hashes.storage; + builder.previous_kernel.append_note_hashes(2); + let prev = builder.previous_kernel.note_hashes.storage; + builder.private_call.append_note_hashes(2); + let mut curr = builder.private_call.note_hashes.storage; builder.note_hash_nullifier_counters[0] = curr[0].counter() + 10; builder.note_hash_nullifier_counters[1] = curr[1].counter() + 75; @@ -180,20 +177,17 @@ fn new_from_previous_kernel_with_private_call_new_note_hashes_with_nullifier_cou curr[0].nullifier_counter = curr[0].counter() + 10; curr[1].nullifier_counter = curr[1].counter() + 75; - assert_array_eq( - output.end.new_note_hashes, - [prev[0], prev[1], curr[0], curr[1]] - ); + assert_array_eq(output.end.note_hashes, [prev[0], prev[1], curr[0], curr[1]]); } #[test] -fn new_from_previous_kernel_with_private_call_new_note_hashes_with_nullifier_counters_more_hints_succeeds() { +fn new_from_previous_kernel_with_private_call_note_hashes_with_nullifier_counters_more_hints_succeeds() { let mut builder = PrivateKernelCircuitPublicInputsComposerBuilder::new(); - builder.previous_kernel.append_new_note_hashes(2); - let prev = builder.previous_kernel.new_note_hashes.storage; - builder.private_call.append_new_note_hashes(2); - let mut curr = builder.private_call.new_note_hashes.storage; + builder.previous_kernel.append_note_hashes(2); + let prev = builder.previous_kernel.note_hashes.storage; + builder.private_call.append_note_hashes(2); + let mut curr = builder.private_call.note_hashes.storage; builder.note_hash_nullifier_counters[0] = curr[0].counter() + 10; builder.note_hash_nullifier_counters[1] = curr[1].counter() + 75; // Add a random nullifier counter for a non-existent note hash to the hints. @@ -203,22 +197,19 @@ fn new_from_previous_kernel_with_private_call_new_note_hashes_with_nullifier_cou curr[0].nullifier_counter = curr[0].counter() + 10; curr[1].nullifier_counter = curr[1].counter() + 75; - assert_array_eq( - output.end.new_note_hashes, - [prev[0], prev[1], curr[0], curr[1]] - ); + assert_array_eq(output.end.note_hashes, [prev[0], prev[1], curr[0], curr[1]]); // The extra counter won't be propagated. - assert_eq(output.end.new_note_hashes[4].nullifier_counter, 0); + assert_eq(output.end.note_hashes[4].nullifier_counter, 0); } #[test(should_fail_with="Invalid nullifier counter")] -fn new_from_previous_kernel_with_private_call_new_note_hashes_with_nullifier_counters_less_than_fails() { +fn new_from_previous_kernel_with_private_call_note_hashes_with_nullifier_counters_less_than_fails() { let mut builder = PrivateKernelCircuitPublicInputsComposerBuilder::new(); - builder.previous_kernel.append_new_note_hashes(2); - let _ = builder.previous_kernel.new_note_hashes.storage; - builder.private_call.append_new_note_hashes(2); - let curr = builder.private_call.new_note_hashes.storage; + builder.previous_kernel.append_note_hashes(2); + let _ = builder.previous_kernel.note_hashes.storage; + builder.private_call.append_note_hashes(2); + let curr = builder.private_call.note_hashes.storage; builder.note_hash_nullifier_counters[0] = curr[0].counter() + 10; // Tweak the nullifier counter to be less than the note hash counter. builder.note_hash_nullifier_counters[1] = curr[1].counter() - 1; @@ -227,34 +218,31 @@ fn new_from_previous_kernel_with_private_call_new_note_hashes_with_nullifier_cou } #[test] -fn new_from_previous_kernel_with_private_call_new_nullifiers_succeeds() { +fn new_from_previous_kernel_with_private_call_nullifiers_succeeds() { let mut builder = PrivateKernelCircuitPublicInputsComposerBuilder::new(); - builder.previous_kernel.append_new_nullifiers(2); - let prev = builder.previous_kernel.new_nullifiers.storage; - builder.private_call.append_new_nullifiers(2); - let curr = builder.private_call.new_nullifiers.storage; + builder.previous_kernel.append_nullifiers(2); + let prev = builder.previous_kernel.nullifiers.storage; + builder.private_call.append_nullifiers(2); + let curr = builder.private_call.nullifiers.storage; let output = builder.compose_from_previous_kernel(); - assert_array_eq( - output.end.new_nullifiers, - [prev[0], prev[1], curr[0], curr[1]] - ); + assert_array_eq(output.end.nullifiers, [prev[0], prev[1], curr[0], curr[1]]); } #[test] -fn new_from_previous_kernel_with_private_call_new_l2_to_l1_msgs_succeeds() { +fn new_from_previous_kernel_with_private_call_l2_to_l1_msgs_succeeds() { let mut builder = PrivateKernelCircuitPublicInputsComposerBuilder::new(); - builder.previous_kernel.append_new_l2_to_l1_msgs(1); - let prev = builder.previous_kernel.new_l2_to_l1_msgs.storage; - builder.private_call.append_new_l2_to_l1_msgs(1); - let curr = builder.private_call.new_l2_to_l1_msgs.storage; + builder.previous_kernel.append_l2_to_l1_msgs(1); + let prev = builder.previous_kernel.l2_to_l1_msgs.storage; + builder.private_call.append_l2_to_l1_msgs(1); + let curr = builder.private_call.l2_to_l1_msgs.storage; let output = builder.compose_from_previous_kernel(); - assert_array_eq(output.end.new_l2_to_l1_msgs, [prev[0], curr[0]]); + assert_array_eq(output.end.l2_to_l1_msgs, [prev[0], curr[0]]); } #[test] diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/new_from_tx_request.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/new_from_tx_request.nr index b29457dee8a..9fdca3bce25 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/new_from_tx_request.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/new_from_tx_request.nr @@ -25,11 +25,11 @@ fn new_from_tx_request_succeeds() { assert(is_empty(output.constants.global_variables)); // Check first nullifier is set. - assert_eq(output.end.new_nullifiers[0], first_nullifier); + assert_eq(output.end.nullifiers[0], first_nullifier); let array_lengths = PrivateKernelCircuitPublicInputsArrayLengths::new(output); let mut expected_array_lengths = PrivateKernelCircuitPublicInputsArrayLengths::empty(); - expected_array_lengths.new_nullifiers = 1; + expected_array_lengths.nullifiers = 1; assert_eq(array_lengths, expected_array_lengths); // Check values default to empty. diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/propagate_from_private_call.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/propagate_from_private_call.nr index 613cd104cf1..af65939a788 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/propagate_from_private_call.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_public_inputs_composer_builder/propagate_from_private_call.nr @@ -16,11 +16,11 @@ fn propagate_from_private_call_empty_data_succeeds() { let output = builder.compose_from_tx_request(); - assert_eq(output.end.new_nullifiers[0], first_nullifier); + assert_eq(output.end.nullifiers[0], first_nullifier); let array_lengths = PrivateKernelCircuitPublicInputsArrayLengths::new(output); let mut expected_array_lengths = PrivateKernelCircuitPublicInputsArrayLengths::empty(); - expected_array_lengths.new_nullifiers = 1; + expected_array_lengths.nullifiers = 1; assert_eq(array_lengths, expected_array_lengths); assert_eq(output.min_revertible_side_effect_counter, 0); @@ -98,23 +98,23 @@ fn propagate_from_private_call_key_validation_requests_succeeds() { } #[test] -fn propagate_from_private_call_new_note_hashes_succeeds() { +fn propagate_from_private_call_note_hashes_succeeds() { let mut builder = PrivateKernelCircuitPublicInputsComposerBuilder::new(); - builder.private_call.append_new_note_hashes(2); - let res = builder.private_call.new_note_hashes.storage; + builder.private_call.append_note_hashes(2); + let res = builder.private_call.note_hashes.storage; let output = builder.compose_from_tx_request(); - assert_array_eq(output.end.new_note_hashes, [res[0], res[1]]); + assert_array_eq(output.end.note_hashes, [res[0], res[1]]); } #[test] -fn propagate_from_private_call_new_note_hashes_with_nullifier_counters_succeeds() { +fn propagate_from_private_call_note_hashes_with_nullifier_counters_succeeds() { let mut builder = PrivateKernelCircuitPublicInputsComposerBuilder::new(); - builder.private_call.append_new_note_hashes(2); - let mut res = builder.private_call.new_note_hashes.storage; + builder.private_call.append_note_hashes(2); + let mut res = builder.private_call.note_hashes.storage; builder.note_hash_nullifier_counters[0] = res[0].counter() + 10; builder.note_hash_nullifier_counters[1] = res[1].counter() + 75; @@ -122,15 +122,15 @@ fn propagate_from_private_call_new_note_hashes_with_nullifier_counters_succeeds( res[0].nullifier_counter = res[0].counter() + 10; res[1].nullifier_counter = res[1].counter() + 75; - assert_array_eq(output.end.new_note_hashes, [res[0], res[1]]); + assert_array_eq(output.end.note_hashes, [res[0], res[1]]); } #[test] -fn propagate_from_private_call_new_note_hashes_with_nullifier_counters_more_hints_succeeds() { +fn propagate_from_private_call_note_hashes_with_nullifier_counters_more_hints_succeeds() { let mut builder = PrivateKernelCircuitPublicInputsComposerBuilder::new(); - builder.private_call.append_new_note_hashes(2); - let mut res = builder.private_call.new_note_hashes.storage; + builder.private_call.append_note_hashes(2); + let mut res = builder.private_call.note_hashes.storage; builder.note_hash_nullifier_counters[0] = res[0].counter() + 10; builder.note_hash_nullifier_counters[1] = res[1].counter() + 75; // Add a random nullifier counter for a non-existent note hash to the hints. @@ -140,17 +140,17 @@ fn propagate_from_private_call_new_note_hashes_with_nullifier_counters_more_hint res[0].nullifier_counter = res[0].counter() + 10; res[1].nullifier_counter = res[1].counter() + 75; - assert_array_eq(output.end.new_note_hashes, [res[0], res[1]]); + assert_array_eq(output.end.note_hashes, [res[0], res[1]]); // The extra counter won't be propagated. - assert_eq(output.end.new_note_hashes[2].nullifier_counter, 0); + assert_eq(output.end.note_hashes[2].nullifier_counter, 0); } #[test(should_fail_with="Invalid nullifier counter")] -fn propagate_from_private_call_new_note_hashes_with_nullifier_counters_less_than_fails() { +fn propagate_from_private_call_note_hashes_with_nullifier_counters_less_than_fails() { let mut builder = PrivateKernelCircuitPublicInputsComposerBuilder::new(); - builder.private_call.append_new_note_hashes(2); - let mut res = builder.private_call.new_note_hashes.storage; + builder.private_call.append_note_hashes(2); + let mut res = builder.private_call.note_hashes.storage; builder.note_hash_nullifier_counters[0] = res[0].counter() + 10; // Tweak the nullifier counter to be less than the note hash counter. builder.note_hash_nullifier_counters[1] = res[1].counter() - 1; @@ -159,30 +159,30 @@ fn propagate_from_private_call_new_note_hashes_with_nullifier_counters_less_than } #[test] -fn propagate_from_private_call_new_nullifiers_succeeds() { +fn propagate_from_private_call_nullifiers_succeeds() { let mut builder = PrivateKernelCircuitPublicInputsComposerBuilder::new(); - builder.private_call.append_new_nullifiers(2); - let res = builder.private_call.new_nullifiers.storage; + builder.private_call.append_nullifiers(2); + let res = builder.private_call.nullifiers.storage; let tx_request = builder.tx_request; let first_nullifier = create_first_nullifier(tx_request); let output = builder.compose_from_tx_request(); - assert_array_eq(output.end.new_nullifiers, [first_nullifier, res[0], res[1]]); + assert_array_eq(output.end.nullifiers, [first_nullifier, res[0], res[1]]); } #[test] -fn propagate_from_private_call_new_l2_to_l1_msgs_succeeds() { +fn propagate_from_private_call_l2_to_l1_msgs_succeeds() { let mut builder = PrivateKernelCircuitPublicInputsComposerBuilder::new(); - builder.private_call.append_new_l2_to_l1_msgs(2); - let res = builder.private_call.new_l2_to_l1_msgs.storage; + builder.private_call.append_l2_to_l1_msgs(2); + let res = builder.private_call.l2_to_l1_msgs.storage; let output = builder.compose_from_tx_request(); - assert_array_eq(output.end.new_l2_to_l1_msgs, [res[0], res[1]]); + assert_array_eq(output.end.l2_to_l1_msgs, [res[0], res[1]]); } #[test] diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_output_validator_builder/validate_propagated_sorted_siloed_values.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_output_validator_builder/validate_propagated_sorted_siloed_values.nr index bd9437270b2..a1d68769169 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_output_validator_builder/validate_propagated_sorted_siloed_values.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_output_validator_builder/validate_propagated_sorted_siloed_values.nr @@ -2,116 +2,116 @@ use crate::tests::tail_output_validator_builder::TailOutputValidatorBuilder; use dep::types::tests::utils::swap_items; /** - * new_note_hashes + * note_hashes */ #[test] -fn validate_propagated_sorted_siloed_values_new_note_hashes_succeeds() { +fn validate_propagated_sorted_siloed_values_note_hashes_succeeds() { let mut builder = TailOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_note_hashes(3); + builder.previous_kernel.append_note_hashes(3); builder.output.append_siloed_note_hashes(3); builder.validate(); } #[test] -fn validate_propagated_sorted_siloed_values_new_note_hashes_unordered_succeeds() { +fn validate_propagated_sorted_siloed_values_note_hashes_unordered_succeeds() { let mut builder = TailOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_note_hashes(3); - swap_items(&mut builder.previous_kernel.new_note_hashes, 0, 2); + builder.previous_kernel.append_note_hashes(3); + swap_items(&mut builder.previous_kernel.note_hashes, 0, 2); for i in 0..3 { // Need to silo the note hashes in the right order to hash with the correct index. - builder.output.add_siloed_note_hash(builder.previous_kernel.new_note_hashes.storage[i].value()); + builder.output.add_siloed_note_hash(builder.previous_kernel.note_hashes.storage[i].value()); } - swap_items(&mut builder.output.new_note_hashes, 0, 2); + swap_items(&mut builder.output.note_hashes, 0, 2); builder.validate(); } #[test(should_fail_with="mismatch sorted values")] -fn validate_propagated_sorted_siloed_values_new_note_hashes_mismatch_hash_fails() { +fn validate_propagated_sorted_siloed_values_note_hashes_mismatch_hash_fails() { let mut builder = TailOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_note_hashes(2); + builder.previous_kernel.append_note_hashes(2); builder.output.append_siloed_note_hashes(2); // Tweak the hash in the output. - builder.output.new_note_hashes.storage[0].note_hash.value += 1; + builder.output.note_hashes.storage[0].note_hash.value += 1; builder.validate(); } /** - * new_nullifiers + * nullifiers */ #[test] -fn validate_propagated_sorted_siloed_values_new_nullifiers_succeeds() { +fn validate_propagated_sorted_siloed_values_nullifiers_succeeds() { let mut builder = TailOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_nullifiers(3); + builder.previous_kernel.append_nullifiers(3); builder.output.append_siloed_nullifiers(3); builder.validate(); } #[test] -fn validate_propagated_sorted_siloed_values_new_nullifiers_unordered_succeeds() { +fn validate_propagated_sorted_siloed_values_nullifiers_unordered_succeeds() { let mut builder = TailOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_nullifiers(3); - swap_items(&mut builder.previous_kernel.new_nullifiers, 0, 3); + builder.previous_kernel.append_nullifiers(3); + swap_items(&mut builder.previous_kernel.nullifiers, 0, 3); builder.output.append_siloed_nullifiers(3); builder.validate(); } #[test(should_fail_with="mismatch sorted values")] -fn validate_propagated_sorted_siloed_values_new_nullifiers_mismatch_hash_fails() { +fn validate_propagated_sorted_siloed_values_nullifiers_mismatch_hash_fails() { let mut builder = TailOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_nullifiers(3); + builder.previous_kernel.append_nullifiers(3); builder.output.append_siloed_nullifiers(3); // Tweak the hash in the output. - builder.output.new_nullifiers.storage[0].nullifier.value += 1; + builder.output.nullifiers.storage[0].nullifier.value += 1; builder.validate(); } /** - * new_l2_to_l1_msgs + * l2_to_l1_msgs */ #[test] -fn validate_propagated_sorted_siloed_values_new_l2_to_l1_msgs_succeeds() { +fn validate_propagated_sorted_siloed_values_l2_to_l1_msgs_succeeds() { let mut builder = TailOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_l2_to_l1_msgs(2); + builder.previous_kernel.append_l2_to_l1_msgs(2); builder.output.append_siloed_l2_to_l1_msgs(2); builder.validate(); } #[test] -fn validate_propagated_sorted_siloed_values_new_l2_to_l1_msgs_unordered_succeeds() { +fn validate_propagated_sorted_siloed_values_l2_to_l1_msgs_unordered_succeeds() { let mut builder = TailOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_l2_to_l1_msgs(2); - swap_items(&mut builder.previous_kernel.new_l2_to_l1_msgs, 0, 1); + builder.previous_kernel.append_l2_to_l1_msgs(2); + swap_items(&mut builder.previous_kernel.l2_to_l1_msgs, 0, 1); builder.output.append_siloed_l2_to_l1_msgs(2); builder.validate(); } #[test(should_fail_with="mismatch sorted values")] -fn validate_propagated_sorted_siloed_values_new_l2_to_l1_msgs_mismatch_hash_fails() { +fn validate_propagated_sorted_siloed_values_l2_to_l1_msgs_mismatch_hash_fails() { let mut builder = TailOutputValidatorBuilder::new(); - builder.previous_kernel.append_new_l2_to_l1_msgs(2); + builder.previous_kernel.append_l2_to_l1_msgs(2); builder.output.append_siloed_l2_to_l1_msgs(2); // Tweak the content in the output. - builder.output.new_l2_to_l1_msgs.storage[0].message.content += 1; + builder.output.l2_to_l1_msgs.storage[0].message.content += 1; builder.validate(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/meter_gas_used.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/meter_gas_used.nr index a37c9b4bb6e..98b998134ee 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/meter_gas_used.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/meter_gas_used.nr @@ -16,9 +16,9 @@ fn meter_gas_used_non_revertible_empty_succeeds() { fn meter_gas_used_non_revertible_everything_succeeds() { let mut builder = FixtureBuilder::new(); - builder.append_new_note_hashes(4); - builder.append_new_nullifiers(3); - builder.append_new_l2_to_l1_msgs(1); + builder.append_note_hashes(4); + builder.append_nullifiers(3); + builder.append_l2_to_l1_msgs(1); builder.add_note_encrypted_log_hash(1001, 12, 0); builder.add_note_encrypted_log_hash(1002, 8, 0); builder.add_note_encrypted_log_hash(1003, 20, 0); @@ -53,9 +53,9 @@ fn meter_gas_used_revertible_empty_succeeds() { fn meter_gas_used_revertible_everything_succeeds() { let mut builder = FixtureBuilder::new(); - builder.append_new_note_hashes(4); - builder.append_new_nullifiers(3); - builder.append_new_l2_to_l1_msgs(1); + builder.append_note_hashes(4); + builder.append_nullifiers(3); + builder.append_l2_to_l1_msgs(1); builder.add_note_encrypted_log_hash(1001, 12, 0); builder.add_note_encrypted_log_hash(1002, 8, 0); builder.add_note_encrypted_log_hash(1003, 20, 0); diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/split_to_public.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/split_to_public.nr index 0f3c016b96c..1cb4c9d081d 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/split_to_public.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/split_to_public.nr @@ -6,18 +6,18 @@ fn split_to_public_succeeds() { let mut builder = FixtureBuilder::new(); // Non-revertibles. - builder.append_new_note_hashes(2); - builder.append_new_nullifiers(2); - builder.append_new_l2_to_l1_msgs(1); + builder.append_note_hashes(2); + builder.append_nullifiers(2); + builder.append_l2_to_l1_msgs(1); builder.append_note_encrypted_log_hashes(3); builder.append_encrypted_log_hashes(2); builder.append_unencrypted_log_hashes(1); builder.append_public_call_requests(1); builder.end_setup(); // Revertibles. - builder.append_new_note_hashes(3); - builder.append_new_nullifiers(1); - builder.append_new_l2_to_l1_msgs(1); + builder.append_note_hashes(3); + builder.append_nullifiers(1); + builder.append_l2_to_l1_msgs(1); builder.append_note_encrypted_log_hashes(1); builder.append_encrypted_log_hashes(2); builder.append_unencrypted_log_hashes(1); @@ -29,29 +29,26 @@ fn split_to_public_succeeds() { builder.min_revertible_side_effect_counter ); - // new_note_hashes - let expected = combined_data.new_note_hashes; + // note_hashes + let expected = combined_data.note_hashes; assert_array_eq( - non_revertible.new_note_hashes.storage, + non_revertible.note_hashes.storage, [expected[0], expected[1]] ); assert_array_eq( - revertible.new_note_hashes.storage, + revertible.note_hashes.storage, [expected[2], expected[3], expected[4]] ); - // new_nullifiers - let expected = combined_data.new_nullifiers; - assert_array_eq( - non_revertible.new_nullifiers.storage, - [expected[0], expected[1]] - ); - assert_array_eq(revertible.new_nullifiers.storage, [expected[2]]); + // nullifiers + let expected = combined_data.nullifiers; + assert_array_eq(non_revertible.nullifiers.storage, [expected[0], expected[1]]); + assert_array_eq(revertible.nullifiers.storage, [expected[2]]); - // new_l2_to_l1_msgs - let expected = combined_data.new_l2_to_l1_msgs; - assert_array_eq(non_revertible.new_l2_to_l1_msgs.storage, [expected[0]]); - assert_array_eq(revertible.new_l2_to_l1_msgs.storage, [expected[1]]); + // l2_to_l1_msgs + let expected = combined_data.l2_to_l1_msgs; + assert_array_eq(non_revertible.l2_to_l1_msgs.storage, [expected[0]]); + assert_array_eq(revertible.l2_to_l1_msgs.storage, [expected[1]]); // note_encrypted_logs_hashes let expected = combined_data.note_encrypted_logs_hashes; @@ -90,7 +87,7 @@ fn split_to_public_succeeds() { fn split_to_public_zero_counter_succeeds() { let mut builder = FixtureBuilder::new(); - builder.append_new_note_hashes(2); + builder.append_note_hashes(2); builder.set_first_nullifier(); let combined_data = builder.to_exposed_public_accumulated_data(); @@ -99,16 +96,13 @@ fn split_to_public_zero_counter_succeeds() { builder.min_revertible_side_effect_counter ); - // new_note_hashes - let expected = combined_data.new_note_hashes; - assert_array_eq(non_revertible.new_note_hashes.storage, []); - assert_array_eq( - revertible.new_note_hashes.storage, - [expected[0], expected[1]] - ); + // note_hashes + let expected = combined_data.note_hashes; + assert_array_eq(non_revertible.note_hashes.storage, []); + assert_array_eq(revertible.note_hashes.storage, [expected[0], expected[1]]); - // new_nullifiers - let expected = combined_data.new_nullifiers; - assert_array_eq(non_revertible.new_nullifiers.storage, [expected[0]]); - assert_array_eq(revertible.new_nullifiers.storage, []); + // nullifiers + let expected = combined_data.nullifiers; + assert_array_eq(non_revertible.nullifiers.storage, [expected[0]]); + assert_array_eq(revertible.nullifiers.storage, []); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/tail_to_public_output_composer.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/tail_to_public_output_composer.nr index 32050cd2b81..8f9bb886ae4 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/tail_to_public_output_composer.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/tail_to_public_output_composer.nr @@ -12,13 +12,13 @@ fn tail_to_public_output_composer_succeeds() { builder.previous_kernel.tx_context.gas_settings.teardown_gas_limits = teardown_gas; // Non-revertibles. - builder.previous_kernel.append_new_note_hashes(4); + builder.previous_kernel.append_note_hashes(4); siloed_data_builder.append_siloed_note_hashes(4); - builder.previous_kernel.append_new_nullifiers(2); + builder.previous_kernel.append_nullifiers(2); siloed_data_builder.append_siloed_nullifiers(2); - builder.previous_kernel.append_new_l2_to_l1_msgs(1); + builder.previous_kernel.append_l2_to_l1_msgs(1); siloed_data_builder.append_siloed_l2_to_l1_msgs(1); builder.previous_kernel.add_note_encrypted_log_hash(1001, 12, 0); @@ -35,13 +35,13 @@ fn tail_to_public_output_composer_succeeds() { builder.previous_kernel.end_setup(); // Revertibles. - builder.previous_kernel.append_new_note_hashes(2); + builder.previous_kernel.append_note_hashes(2); siloed_data_builder.append_siloed_note_hashes(2); - builder.previous_kernel.append_new_nullifiers(1); + builder.previous_kernel.append_nullifiers(1); siloed_data_builder.append_siloed_nullifiers(1); - builder.previous_kernel.append_new_l2_to_l1_msgs(1); + builder.previous_kernel.append_l2_to_l1_msgs(1); siloed_data_builder.append_siloed_l2_to_l1_msgs(1); builder.previous_kernel.add_note_encrypted_log_hash(1003, 20, 0); @@ -61,10 +61,10 @@ fn tail_to_public_output_composer_succeeds() { let unsiloed_data = builder.previous_kernel.to_exposed_public_accumulated_data(); // Shuffle ordered items. - swap_items(&mut builder.previous_kernel.new_note_hashes, 4, 0); - swap_items(&mut builder.previous_kernel.new_note_hashes, 3, 2); - swap_items(&mut builder.previous_kernel.new_nullifiers, 1, 3); - swap_items(&mut builder.previous_kernel.new_l2_to_l1_msgs, 0, 1); + swap_items(&mut builder.previous_kernel.note_hashes, 4, 0); + swap_items(&mut builder.previous_kernel.note_hashes, 3, 2); + swap_items(&mut builder.previous_kernel.nullifiers, 1, 3); + swap_items(&mut builder.previous_kernel.l2_to_l1_msgs, 0, 1); swap_items(&mut builder.previous_kernel.note_encrypted_logs_hashes, 1, 2); swap_items(&mut builder.previous_kernel.encrypted_logs_hashes, 1, 2); swap_items(&mut builder.previous_kernel.public_call_requests, 1, 2); @@ -72,27 +72,27 @@ fn tail_to_public_output_composer_succeeds() { // Output. let output = builder.finish(); - // new_note_hashes - let siloed = siloed_data.new_note_hashes; + // note_hashes + let siloed = siloed_data.note_hashes; assert_array_eq( - output.end_non_revertible.new_note_hashes, + output.end_non_revertible.note_hashes, [siloed[0], siloed[1], siloed[2], siloed[3]] ); - assert_array_eq(output.end.new_note_hashes, [siloed[4], siloed[5]]); + assert_array_eq(output.end.note_hashes, [siloed[4], siloed[5]]); - // new_nullifiers - let siloed = siloed_data.new_nullifiers; - let unsiloed = unsiloed_data.new_nullifiers; + // nullifiers + let siloed = siloed_data.nullifiers; + let unsiloed = unsiloed_data.nullifiers; assert_array_eq( - output.end_non_revertible.new_nullifiers, + output.end_non_revertible.nullifiers, [unsiloed[0], siloed[1], siloed[2]] ); - assert_array_eq(output.end.new_nullifiers, [siloed[3]]); + assert_array_eq(output.end.nullifiers, [siloed[3]]); - // new_l2_to_l1_msgs - let siloed = siloed_data.new_l2_to_l1_msgs; - assert_array_eq(output.end_non_revertible.new_l2_to_l1_msgs, [siloed[0]]); - assert_array_eq(output.end.new_l2_to_l1_msgs, [siloed[1]]); + // l2_to_l1_msgs + let siloed = siloed_data.l2_to_l1_msgs; + assert_array_eq(output.end_non_revertible.l2_to_l1_msgs, [siloed[0]]); + assert_array_eq(output.end.l2_to_l1_msgs, [siloed[1]]); // note_encrypted_logs_hashes let unsiloed = unsiloed_data.note_encrypted_logs_hashes; diff --git a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/common.nr b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/common.nr index 7304e26463a..4dfe96d6083 100644 --- a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/common.nr +++ b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/common.nr @@ -10,7 +10,7 @@ use dep::types::{ address::AztecAddress, contrakt::{storage_read::StorageRead, storage_update_request::StorageUpdateRequest}, constants::{ - MAX_NEW_L2_TO_L1_MSGS_PER_CALL, MAX_NEW_NOTE_HASHES_PER_CALL, MAX_NEW_NULLIFIERS_PER_CALL, + MAX_L2_TO_L1_MSGS_PER_CALL, MAX_NOTE_HASHES_PER_CALL, MAX_NULLIFIERS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL, MAX_PUBLIC_DATA_READS_PER_CALL, MAX_UNENCRYPTED_LOGS_PER_CALL @@ -73,9 +73,9 @@ pub fn initialize_end_values( circuit_outputs: &mut PublicKernelCircuitPublicInputsBuilder ) { let start = previous_kernel.public_inputs.end; - circuit_outputs.end.new_note_hashes = array_to_bounded_vec(start.new_note_hashes); - circuit_outputs.end.new_nullifiers = array_to_bounded_vec(start.new_nullifiers); - circuit_outputs.end.new_l2_to_l1_msgs = array_to_bounded_vec(start.new_l2_to_l1_msgs); + circuit_outputs.end.note_hashes = array_to_bounded_vec(start.note_hashes); + circuit_outputs.end.nullifiers = array_to_bounded_vec(start.nullifiers); + circuit_outputs.end.l2_to_l1_msgs = array_to_bounded_vec(start.l2_to_l1_msgs); circuit_outputs.end.public_data_update_requests = array_to_bounded_vec(start.public_data_update_requests); circuit_outputs.end.unencrypted_logs_hashes = array_to_bounded_vec(start.unencrypted_logs_hashes); circuit_outputs.end.note_encrypted_logs_hashes = array_to_bounded_vec(start.note_encrypted_logs_hashes); @@ -97,9 +97,9 @@ pub fn initialize_non_revertible_values( circuit_outputs.end_non_revertible.gas_used = previous_kernel.public_inputs.end_non_revertible.gas_used; let start_non_revertible = previous_kernel.public_inputs.end_non_revertible; - circuit_outputs.end_non_revertible.new_note_hashes = array_to_bounded_vec(start_non_revertible.new_note_hashes); - circuit_outputs.end_non_revertible.new_nullifiers = array_to_bounded_vec(start_non_revertible.new_nullifiers); - circuit_outputs.end_non_revertible.new_l2_to_l1_msgs = array_to_bounded_vec(start_non_revertible.new_l2_to_l1_msgs); + circuit_outputs.end_non_revertible.note_hashes = array_to_bounded_vec(start_non_revertible.note_hashes); + circuit_outputs.end_non_revertible.nullifiers = array_to_bounded_vec(start_non_revertible.nullifiers); + circuit_outputs.end_non_revertible.l2_to_l1_msgs = array_to_bounded_vec(start_non_revertible.l2_to_l1_msgs); circuit_outputs.end_non_revertible.public_data_update_requests = array_to_bounded_vec(start_non_revertible.public_data_update_requests); circuit_outputs.end_non_revertible.unencrypted_logs_hashes = array_to_bounded_vec(start_non_revertible.unencrypted_logs_hashes); circuit_outputs.end_non_revertible.note_encrypted_logs_hashes = array_to_bounded_vec(start_non_revertible.note_encrypted_logs_hashes); @@ -117,19 +117,19 @@ fn perform_static_call_checks(public_call: PublicCallData) { let public_inputs = public_call.call_stack_item.public_inputs; if public_inputs.call_context.is_static_call { // No state changes are allowed for static calls: - let new_note_hashes_length = array_length(public_inputs.new_note_hashes); - assert(new_note_hashes_length == 0, "new_note_hashes must be empty for static calls"); + let note_hashes_length = array_length(public_inputs.note_hashes); + assert(note_hashes_length == 0, "note_hashes must be empty for static calls"); - let new_nullifiers_length = array_length(public_inputs.new_nullifiers); - assert(new_nullifiers_length == 0, "new_nullifiers must be empty for static calls"); + let nullifiers_length = array_length(public_inputs.nullifiers); + assert(nullifiers_length == 0, "nullifiers must be empty for static calls"); let update_requests_length = array_length(public_inputs.contract_storage_update_requests); assert( update_requests_length == 0, "No contract storage update requests are allowed for static calls" ); - let new_l2_to_l1_msgs_length = array_length(public_inputs.new_l2_to_l1_msgs); - assert(new_l2_to_l1_msgs_length == 0, "new_l2_to_l1_msgs must be empty for static calls"); + let l2_to_l1_msgs_length = array_length(public_inputs.l2_to_l1_msgs); + assert(l2_to_l1_msgs_length == 0, "l2_to_l1_msgs must be empty for static calls"); let new_unencrypted_logs_length = array_length(public_inputs.unencrypted_logs_hashes); assert(new_unencrypted_logs_length == 0, "No unencrypted logs are allowed for static calls"); @@ -279,8 +279,8 @@ pub fn update_public_end_non_revertible_values( // If this call is a static call, certain operations are disallowed, such as creating new state. perform_static_call_checks(public_call); - propagate_new_nullifiers_non_revertible(public_call, circuit_outputs); - propagate_new_note_hashes_non_revertible(public_call, circuit_outputs); + propagate_nullifiers_non_revertible(public_call, circuit_outputs); + propagate_note_hashes_non_revertible(public_call, circuit_outputs); propagate_new_l2_to_l1_messages_non_revertible(public_call, circuit_outputs); propagate_new_unencrypted_logs_non_revertible(public_call, circuit_outputs); propagate_valid_non_revertible_public_data_update_requests(public_call, circuit_outputs); @@ -292,8 +292,8 @@ pub fn update_public_end_values(public_call: PublicCallData, circuit_outputs: &m // If this call is a static call, certain operations are disallowed, such as creating new state. perform_static_call_checks(public_call); - propagate_new_nullifiers(public_call, circuit_outputs); - propagate_new_note_hashes(public_call, circuit_outputs); + propagate_nullifiers(public_call, circuit_outputs); + propagate_note_hashes(public_call, circuit_outputs); propagate_new_l2_to_l1_messages(public_call, circuit_outputs); propagate_new_unencrypted_logs(public_call, circuit_outputs); propagate_valid_public_data_update_requests(public_call, circuit_outputs); @@ -386,96 +386,79 @@ fn propagate_valid_public_data_reads(public_call: PublicCallData, circuit_output circuit_outputs.validation_requests.public_data_reads.extend_from_bounded_vec(public_data_reads); } -fn propagate_new_note_hashes_non_revertible( +fn propagate_note_hashes_non_revertible( public_call: PublicCallData, circuit_outputs: &mut PublicKernelCircuitPublicInputsBuilder ) { let public_call_public_inputs = public_call.call_stack_item.public_inputs; - let new_note_hashes = public_call.call_stack_item.public_inputs.new_note_hashes; + let note_hashes = public_call.call_stack_item.public_inputs.note_hashes; let storage_contract_address = public_call_public_inputs.call_context.storage_contract_address; - let mut siloed_new_note_hashes : BoundedVec = BoundedVec::new(); - for i in 0..MAX_NEW_NOTE_HASHES_PER_CALL { - let new_note_hash = new_note_hashes[i].value; + let mut siloed_note_hashes : BoundedVec = BoundedVec::new(); + for i in 0..MAX_NOTE_HASHES_PER_CALL { + let new_note_hash = note_hashes[i].value; if new_note_hash != 0 { let siloed_new_note_hash = compute_siloed_note_hash(storage_contract_address, new_note_hash); - siloed_new_note_hashes.push(NoteHash { value: siloed_new_note_hash, counter: new_note_hashes[i].counter }); + siloed_note_hashes.push(NoteHash { value: siloed_new_note_hash, counter: note_hashes[i].counter }); } } - circuit_outputs.end_non_revertible.new_note_hashes.extend_from_bounded_vec(siloed_new_note_hashes); + circuit_outputs.end_non_revertible.note_hashes.extend_from_bounded_vec(siloed_note_hashes); } -fn propagate_new_note_hashes( - public_call: PublicCallData, - circuit_outputs: &mut PublicKernelCircuitPublicInputsBuilder -) { +fn propagate_note_hashes(public_call: PublicCallData, circuit_outputs: &mut PublicKernelCircuitPublicInputsBuilder) { let public_call_public_inputs = public_call.call_stack_item.public_inputs; - let new_note_hashes = public_call.call_stack_item.public_inputs.new_note_hashes; + let note_hashes = public_call.call_stack_item.public_inputs.note_hashes; let storage_contract_address = public_call_public_inputs.call_context.storage_contract_address; - let mut siloed_new_note_hashes : BoundedVec = BoundedVec::new(); - for i in 0..MAX_NEW_NOTE_HASHES_PER_CALL { - let new_note_hash = new_note_hashes[i].value; + let mut siloed_note_hashes : BoundedVec = BoundedVec::new(); + for i in 0..MAX_NOTE_HASHES_PER_CALL { + let new_note_hash = note_hashes[i].value; if new_note_hash != 0 { let siloed_new_note_hash = compute_siloed_note_hash(storage_contract_address, new_note_hash); - siloed_new_note_hashes.push(NoteHash { value: siloed_new_note_hash, counter: new_note_hashes[i].counter }); + siloed_note_hashes.push(NoteHash { value: siloed_new_note_hash, counter: note_hashes[i].counter }); } } - circuit_outputs.end.new_note_hashes.extend_from_bounded_vec(siloed_new_note_hashes); + circuit_outputs.end.note_hashes.extend_from_bounded_vec(siloed_note_hashes); } -fn propagate_new_nullifiers_non_revertible( - public_call: PublicCallData, - circuit_outputs: &mut PublicKernelCircuitPublicInputsBuilder -) { - let new_nullifiers = public_call.call_stack_item.public_inputs.new_nullifiers; +fn propagate_nullifiers_non_revertible(public_call: PublicCallData, circuit_outputs: &mut PublicKernelCircuitPublicInputsBuilder) { + let nullifiers = public_call.call_stack_item.public_inputs.nullifiers; let storage_contract_address = public_call.call_stack_item.public_inputs.call_context.storage_contract_address; // Enhance commitments and nullifiers with domain separation whereby domain is the contract. - let mut siloed_new_nullifiers : BoundedVec = BoundedVec::new(); - for i in 0..MAX_NEW_NULLIFIERS_PER_CALL { - let new_nullifier = new_nullifiers[i].value; + let mut siloed_nullifiers : BoundedVec = BoundedVec::new(); + for i in 0..MAX_NULLIFIERS_PER_CALL { + let new_nullifier = nullifiers[i].value; if new_nullifier != 0 { let siloed_new_nullifier = compute_siloed_nullifier(storage_contract_address, new_nullifier); - siloed_new_nullifiers.push( - Nullifier { - value: siloed_new_nullifier, - counter: new_nullifiers[i].counter, - note_hash: new_nullifiers[i].note_hash - } + siloed_nullifiers.push( + Nullifier { value: siloed_new_nullifier, counter: nullifiers[i].counter, note_hash: nullifiers[i].note_hash } ); } } - circuit_outputs.end_non_revertible.new_nullifiers.extend_from_bounded_vec(siloed_new_nullifiers); + circuit_outputs.end_non_revertible.nullifiers.extend_from_bounded_vec(siloed_nullifiers); } -fn propagate_new_nullifiers( - public_call: PublicCallData, - circuit_outputs: &mut PublicKernelCircuitPublicInputsBuilder -) { - let new_nullifiers = public_call.call_stack_item.public_inputs.new_nullifiers; +fn propagate_nullifiers(public_call: PublicCallData, circuit_outputs: &mut PublicKernelCircuitPublicInputsBuilder) { + let nullifiers = public_call.call_stack_item.public_inputs.nullifiers; let storage_contract_address = public_call.call_stack_item.public_inputs.call_context.storage_contract_address; // Enhance commitments and nullifiers with domain separation whereby domain is the contract. - let mut siloed_new_nullifiers : BoundedVec = BoundedVec::new(); - for i in 0..MAX_NEW_NULLIFIERS_PER_CALL { - let new_nullifier = new_nullifiers[i].value; + let mut siloed_nullifiers : BoundedVec = BoundedVec::new(); + for i in 0..MAX_NULLIFIERS_PER_CALL { + let new_nullifier = nullifiers[i].value; if new_nullifier != 0 { let siloed_new_nullifier = compute_siloed_nullifier(storage_contract_address, new_nullifier); - siloed_new_nullifiers.push( - Nullifier { - value: siloed_new_nullifier, - counter: new_nullifiers[i].counter, - note_hash: new_nullifiers[i].note_hash - } + siloed_nullifiers.push( + Nullifier { value: siloed_new_nullifier, counter: nullifiers[i].counter, note_hash: nullifiers[i].note_hash } ); } } - circuit_outputs.end.new_nullifiers.extend_from_bounded_vec(siloed_new_nullifiers); + circuit_outputs.end.nullifiers.extend_from_bounded_vec(siloed_nullifiers); } fn propagate_new_l2_to_l1_messages_non_revertible( @@ -486,22 +469,22 @@ fn propagate_new_l2_to_l1_messages_non_revertible( let public_call_public_inputs = public_call.call_stack_item.public_inputs; let storage_contract_address = public_call_public_inputs.call_context.storage_contract_address; - let new_l2_to_l1_msgs = public_call_public_inputs.new_l2_to_l1_msgs; - let mut new_l2_to_l1_msgs_to_insert : BoundedVec = BoundedVec::new(); - for i in 0..MAX_NEW_L2_TO_L1_MSGS_PER_CALL { - let msg = new_l2_to_l1_msgs[i]; + let l2_to_l1_msgs = public_call_public_inputs.l2_to_l1_msgs; + let mut l2_to_l1_msgs_to_insert : BoundedVec = BoundedVec::new(); + for i in 0..MAX_L2_TO_L1_MSGS_PER_CALL { + let msg = l2_to_l1_msgs[i]; if !is_empty(msg) { - let new_l2_to_l1_msgs = compute_l2_to_l1_hash( + let l2_to_l1_msgs = compute_l2_to_l1_hash( storage_contract_address, msg.recipient, msg.content, public_inputs.constants.tx_context.version, public_inputs.constants.tx_context.chain_id ); - new_l2_to_l1_msgs_to_insert.push(new_l2_to_l1_msgs) + l2_to_l1_msgs_to_insert.push(l2_to_l1_msgs) } } - public_inputs.end_non_revertible.new_l2_to_l1_msgs.extend_from_bounded_vec(new_l2_to_l1_msgs_to_insert); + public_inputs.end_non_revertible.l2_to_l1_msgs.extend_from_bounded_vec(l2_to_l1_msgs_to_insert); } fn propagate_new_l2_to_l1_messages(public_call: PublicCallData, public_inputs: &mut PublicKernelCircuitPublicInputsBuilder) { @@ -509,22 +492,22 @@ fn propagate_new_l2_to_l1_messages(public_call: PublicCallData, public_inputs: & let public_call_public_inputs = public_call.call_stack_item.public_inputs; let storage_contract_address = public_call_public_inputs.call_context.storage_contract_address; - let new_l2_to_l1_msgs = public_call_public_inputs.new_l2_to_l1_msgs; - let mut new_l2_to_l1_msgs_to_insert : BoundedVec = BoundedVec::new(); - for i in 0..MAX_NEW_L2_TO_L1_MSGS_PER_CALL { - let msg = new_l2_to_l1_msgs[i]; + let l2_to_l1_msgs = public_call_public_inputs.l2_to_l1_msgs; + let mut l2_to_l1_msgs_to_insert : BoundedVec = BoundedVec::new(); + for i in 0..MAX_L2_TO_L1_MSGS_PER_CALL { + let msg = l2_to_l1_msgs[i]; if !is_empty(msg) { - let new_l2_to_l1_msgs = compute_l2_to_l1_hash( + let l2_to_l1_msgs = compute_l2_to_l1_hash( storage_contract_address, msg.recipient, msg.content, public_inputs.constants.tx_context.version, public_inputs.constants.tx_context.chain_id ); - new_l2_to_l1_msgs_to_insert.push(new_l2_to_l1_msgs) + l2_to_l1_msgs_to_insert.push(l2_to_l1_msgs) } } - public_inputs.end.new_l2_to_l1_msgs.extend_from_bounded_vec(new_l2_to_l1_msgs_to_insert); + public_inputs.end.l2_to_l1_msgs.extend_from_bounded_vec(l2_to_l1_msgs_to_insert); } pub fn propagate_new_unencrypted_logs(public_call: PublicCallData, public_inputs: &mut PublicKernelCircuitPublicInputsBuilder) { 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 56cb614c267..da8ea3554bf 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 @@ -213,8 +213,8 @@ mod tests { let mut builder = PublicKernelAppLogicCircuitPrivateInputsBuilder::new(); let contract_address = builder.public_call.contract_address; // Setup 2 new note hashes and logs on the previous kernel. - builder.previous_kernel.append_new_note_hashes_with_logs(2); - let previous = builder.previous_kernel.new_note_hashes.storage.map(|n: ScopedNoteHash| n.note_hash); + builder.previous_kernel.append_note_hashes_with_logs(2); + let previous = builder.previous_kernel.note_hashes.storage.map(|n: ScopedNoteHash| n.note_hash); let prev_data = builder.previous_kernel.to_public_accumulated_data(); let prev_note_logs = prev_data.note_encrypted_logs_hashes; // Setup 2 new note hashes on the current public inputs. @@ -222,15 +222,15 @@ mod tests { NoteHash { value: previous[1].value + 1, counter: 5 }, NoteHash { value: previous[1].value + 2, counter: 6 } ]; - builder.public_call.public_inputs.new_note_hashes.extend_from_array(current); + builder.public_call.public_inputs.note_hashes.extend_from_array(current); let siloed = current.map(|c: NoteHash| compute_siloed_note_hash(contract_address, c.value)); - let new_note_hashes = [ + let note_hashes = [ previous[0], previous[1], NoteHash { value: siloed[0], counter: 5 }, NoteHash { value: siloed[1], counter: 6 } ]; let public_inputs = builder.execute(); - assert(array_eq(public_inputs.end.new_note_hashes, new_note_hashes)); + assert(array_eq(public_inputs.end.note_hashes, note_hashes)); assert( array_eq( public_inputs.end.note_encrypted_logs_hashes, @@ -282,14 +282,14 @@ mod tests { let contract_address = builder.public_call.contract_address; // Setup 2 new nullifiers on the previous kernel. - builder.previous_kernel.append_new_nullifiers(2); - let previous = builder.previous_kernel.new_nullifiers.storage.map(|n: ScopedNullifier| n.nullifier); + builder.previous_kernel.append_nullifiers(2); + let previous = builder.previous_kernel.nullifiers.storage.map(|n: ScopedNullifier| n.nullifier); // Setup 2 new note hashes on the current public inputs. let current = [ Nullifier { value: previous[1].value + 1, note_hash: 0, counter: 4 }, Nullifier { value: previous[1].value + 2, note_hash: 0, counter: 5 } ]; - builder.public_call.public_inputs.new_nullifiers.extend_from_array(current); + builder.public_call.public_inputs.nullifiers.extend_from_array(current); let siloed = current.map( |current: Nullifier| @@ -298,11 +298,11 @@ mod tests { // There are 2 revertible nullifiers in the previous kernel. // The tx nullifier is part of the non-revertible nullifiers. - let new_nullifiers = [previous[0], previous[1], siloed[0], siloed[1]]; + let nullifiers = [previous[0], previous[1], siloed[0], siloed[1]]; let public_inputs = builder.execute(); - assert(array_eq(public_inputs.end.new_nullifiers, new_nullifiers)); + assert(array_eq(public_inputs.end.nullifiers, nullifiers)); } #[test] @@ -317,17 +317,17 @@ mod tests { builder.previous_kernel.add_l2_to_l1_message(previous[0], portal_contract_address); // Setup 1 new l2 to l1 message on the current public inputs. let current = [L2ToL1Message { recipient: portal_contract_address, content: 67890, counter: 0 }]; - builder.public_call.public_inputs.new_l2_to_l1_msgs.extend_from_array(current); + builder.public_call.public_inputs.l2_to_l1_msgs.extend_from_array(current); let tx_context = builder.previous_kernel.tx_context; let version = tx_context.version; let chain_id = tx_context.chain_id; let siloed = current.map( |c: L2ToL1Message| compute_l2_to_l1_hash(contract_address, c.recipient, c.content, version, chain_id) ); - let new_l2_to_l1_msgs = [previous[0], siloed[0]]; + let l2_to_l1_msgs = [previous[0], siloed[0]]; let public_inputs = builder.execute(); - assert(array_eq(public_inputs.end.new_l2_to_l1_msgs, new_l2_to_l1_msgs)); + assert(array_eq(public_inputs.end.l2_to_l1_msgs, l2_to_l1_msgs)); } // TODO: Break up this test into smaller tests. #[test] @@ -392,20 +392,20 @@ mod tests { builder.failed(); } - #[test(should_fail_with="new_note_hashes must be empty for static calls")] - fn public_kernel_fails_creating_new_note_hashes_on_static_call() { + #[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(); builder.public_call.public_inputs.call_context.is_static_call = true; - builder.public_call.public_inputs.new_note_hashes.push(NoteHash { value: 1, counter: 0 }); + builder.public_call.public_inputs.note_hashes.push(NoteHash { value: 1, counter: 0 }); builder.failed(); } - #[test(should_fail_with="new_nullifiers must be empty for static calls")] - fn public_kernel_fails_creating_new_nullifiers_on_static_call() { + #[test(should_fail_with="nullifiers must be empty for static calls")] + fn public_kernel_fails_creating_nullifiers_on_static_call() { let mut builder = PublicKernelAppLogicCircuitPrivateInputsBuilder::new(); builder.public_call.public_inputs.call_context.is_static_call = true; - builder.public_call.public_inputs.new_nullifiers.push(Nullifier { value: 1, note_hash: 0, counter: 0 }); + builder.public_call.public_inputs.nullifiers.push(Nullifier { value: 1, note_hash: 0, counter: 0 }); builder.failed(); } diff --git a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_tail.nr b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_tail.nr index 2acd153e8d6..bcb64d69486 100644 --- a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_tail.nr +++ b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_tail.nr @@ -9,10 +9,7 @@ use dep::types::{ kernel_circuit_public_inputs::KernelCircuitPublicInputs, public_kernel_data::PublicKernelData, public_data_update_request::PublicDataUpdateRequest, side_effect::Ordered }, - constants::{ - MAX_NEW_NOTE_HASHES_PER_TX, MAX_PUBLIC_DATA_HINTS, MAX_NULLIFIER_READ_REQUESTS_PER_TX, - MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX -}, + constants::{MAX_PUBLIC_DATA_HINTS, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX}, data::public_data_hint::PublicDataHint, merkle_tree::{conditionally_assert_check_membership, MembershipWitness}, partial_state_reference::PartialStateReference, utils::{arrays::array_length}, address::AztecAddress @@ -109,7 +106,7 @@ mod tests { }, address::AztecAddress, constants::{ - MAX_NEW_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_PUBLIC_DATA_HINTS, + MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_PUBLIC_DATA_HINTS, MAX_PUBLIC_DATA_READS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, NULLIFIER_TREE_HEIGHT, NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, NULLIFIER_SUBTREE_HEIGHT, PUBLIC_DATA_SUBTREE_HEIGHT, PUBLIC_DATA_SUBTREE_SIBLING_PATH_LENGTH, PUBLIC_DATA_TREE_HEIGHT, MAX_ENCRYPTED_LOGS_PER_TX, @@ -123,8 +120,8 @@ mod tests { merkle_tree::MembershipWitness }; - fn build_nullifier_tree() -> NonEmptyMerkleTree { - let mut pre_existing_nullifiers = [NullifierLeafPreimage::empty(); MAX_NEW_NULLIFIERS_PER_TX]; + fn build_nullifier_tree() -> NonEmptyMerkleTree { + let mut pre_existing_nullifiers = [NullifierLeafPreimage::empty(); MAX_NULLIFIERS_PER_TX]; pre_existing_nullifiers[0] = NullifierLeafPreimage { nullifier: 0, next_nullifier: 100, next_index: 1 }; pre_existing_nullifiers[1] = NullifierLeafPreimage { nullifier: 100, next_nullifier: 0, next_index: 0 }; NonEmptyMerkleTree::new( @@ -220,8 +217,8 @@ mod tests { fn set_nullifiers_for_non_existent_read_request_hints(&mut self) { let nullifiers = array_merge( - self.previous_kernel.new_nullifiers.storage, - self.previous_revertible.new_nullifiers.storage + self.previous_kernel.nullifiers.storage, + self.previous_revertible.nullifiers.storage ).map(|n: ScopedNullifier| n.nullifier); self.nullifier_non_existent_read_request_hints_builder.set_nullifiers(nullifiers); } @@ -230,7 +227,7 @@ mod tests { let read_request_index = self.previous_kernel.add_read_request_for_pending_nullifier(nullifier_index); self.sync_counters(); let hint_index = self.nullifier_read_request_hints_builder.pending_read_hints.len(); - let pending_value_index = nullifier_index + self.previous_kernel.new_nullifiers.len(); + let pending_value_index = nullifier_index + self.previous_kernel.nullifiers.len(); let hint = PendingReadHint { read_request_index, pending_value_index }; self.nullifier_read_request_hints_builder.pending_read_hints.push(hint); self.nullifier_read_request_hints_builder.read_request_statuses[read_request_index] = ReadRequestStatus { state: ReadRequestState.PENDING, hint_index }; @@ -303,8 +300,8 @@ mod tests { // Note: note hashes are a bit odd here: whereas we'd like to use `combined` and then // sort the result, we cannot because we lose the side effect counters when we combine. let merged = array_merge( - previous_kernel.public_inputs.end_non_revertible.new_note_hashes, - previous_kernel.public_inputs.end.new_note_hashes + previous_kernel.public_inputs.end_non_revertible.note_hashes, + previous_kernel.public_inputs.end.note_hashes ); let sorted = sort_get_sorted_hints(merged, |a: NoteHash, b: NoteHash| a.counter() < b.counter()); let sorted_note_hashes = sorted.sorted_array; @@ -455,7 +452,7 @@ mod tests { builder.append_nullifiers_revertible(3); builder.add_pending_revertible_nullifier_read_request(1); - let nullifier_being_read = builder.previous_revertible.new_nullifiers.get(1); + let nullifier_being_read = builder.previous_revertible.nullifiers.get(1); let mut read_request = builder.previous_kernel.nullifier_read_requests.pop(); read_request.read_request.counter = nullifier_being_read.counter() - 1; builder.previous_kernel.nullifier_read_requests.push(read_request); diff --git a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/nullifier_non_existent_read_request_reset.nr b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/nullifier_non_existent_read_request_reset.nr index b9c8b19879c..fef20b6eeb9 100644 --- a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/nullifier_non_existent_read_request_reset.nr +++ b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/nullifier_non_existent_read_request_reset.nr @@ -2,7 +2,7 @@ use crate::reset::non_existent_read_request::NonMembershipHint; use dep::types::{ abis::{nullifier::Nullifier, nullifier_leaf_preimage::NullifierLeafPreimage}, merkle_tree::MembershipWitness, - constants::{MAX_NEW_NULLIFIERS_PER_TX, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX, NULLIFIER_TREE_HEIGHT} + constants::{MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX, NULLIFIER_TREE_HEIGHT} }; struct NullifierNonMembershipHint { @@ -22,7 +22,7 @@ impl NonMembershipHint for Nullifi struct NullifierNonExistentReadRequestHints { non_membership_hints: [NullifierNonMembershipHint; MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX], - sorted_pending_values: [Nullifier; MAX_NEW_NULLIFIERS_PER_TX], - sorted_pending_value_index_hints: [u32; MAX_NEW_NULLIFIERS_PER_TX], + sorted_pending_values: [Nullifier; MAX_NULLIFIERS_PER_TX], + sorted_pending_value_index_hints: [u32; MAX_NULLIFIERS_PER_TX], next_pending_value_indices: [u32; MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX], } diff --git a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/private_validation_request_processor.nr b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/private_validation_request_processor.nr index ca1fcea8f66..94500890172 100644 --- a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/private_validation_request_processor.nr +++ b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/private_validation_request_processor.nr @@ -10,7 +10,7 @@ use dep::types::{ read_request::ScopedReadRequest }, constants::{ - MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, MAX_KEY_VALIDATION_REQUESTS_PER_TX, + MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_KEY_VALIDATION_REQUESTS_PER_TX, GENERATOR_INDEX__NSK_M, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX }, grumpkin_private_key::GrumpkinPrivateKey, hash::poseidon2_hash, traits::is_empty, @@ -20,10 +20,10 @@ use dep::types::{ struct PrivateValidationRequestProcessor { validation_requests: ValidationRequests, note_hash_read_request_hints: NoteHashReadRequestHints, - pending_note_hashes: [ScopedNoteHash; MAX_NEW_NOTE_HASHES_PER_TX], + pending_note_hashes: [ScopedNoteHash; MAX_NOTE_HASHES_PER_TX], note_hash_tree_root: Field, nullifier_read_request_hints: NullifierReadRequestHints, - pending_nullifiers: [ScopedNullifier; MAX_NEW_NULLIFIERS_PER_TX], + pending_nullifiers: [ScopedNullifier; MAX_NULLIFIERS_PER_TX], nullifier_tree_root: Field, key_validation_hints: [KeyValidationHint; KEY_VALIDATION_REQUESTS], } diff --git a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/public_validation_request_processor.nr b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/public_validation_request_processor.nr index fc72928b385..c0d9adf3313 100644 --- a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/public_validation_request_processor.nr +++ b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/public_validation_request_processor.nr @@ -13,14 +13,14 @@ use dep::types::{ public_data_update_request::PublicDataUpdateRequest, validation_requests::ValidationRequests }, data::public_data_hint::PublicDataHint, - constants::{MAX_NEW_NULLIFIERS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX}, + constants::{MAX_NULLIFIERS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX}, hash::compute_siloed_nullifier, traits::is_empty, utils::arrays::{array_merge, array_to_bounded_vec, assert_sorted_array} }; struct PublicValidationRequestProcessor { validation_requests: ValidationRequests, - pending_nullifiers: [Nullifier; MAX_NEW_NULLIFIERS_PER_TX], + pending_nullifiers: [Nullifier; MAX_NULLIFIERS_PER_TX], pending_public_data_writes: [PublicDataUpdateRequest; MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX], nullifier_read_request_hints: NullifierReadRequestHints, nullifier_non_existent_read_request_hints: NullifierNonExistentReadRequestHints, @@ -41,7 +41,7 @@ impl PublicValidationRequestProcessor { let end_non_revertible = public_inputs.end_non_revertible; let end = public_inputs.end; - let pending_nullifiers = array_merge(end_non_revertible.new_nullifiers, end.new_nullifiers); + let pending_nullifiers = array_merge(end_non_revertible.nullifiers, end.nullifiers); let pending_public_data_writes = array_merge( end_non_revertible.public_data_update_requests, diff --git a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/tests/nullifier_non_existent_read_request_hints_builder.nr b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/tests/nullifier_non_existent_read_request_hints_builder.nr index aeb0e840409..1d9a3e60165 100644 --- a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/tests/nullifier_non_existent_read_request_hints_builder.nr +++ b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/tests/nullifier_non_existent_read_request_hints_builder.nr @@ -2,7 +2,7 @@ use crate::nullifier_non_existent_read_request_reset::{NullifierNonMembershipHin use dep::types::{ abis::{nullifier::Nullifier, nullifier_leaf_preimage::NullifierLeafPreimage}, constants::{ - MAX_NEW_NULLIFIERS_PER_TX, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX, NULLIFIER_TREE_HEIGHT, + MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX, NULLIFIER_TREE_HEIGHT, NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, NULLIFIER_SUBTREE_HEIGHT }, merkle_tree::MembershipWitness, tests::{merkle_tree_utils::NonEmptyMerkleTree}, @@ -10,10 +10,10 @@ use dep::types::{ }; struct NullifierNonExistentReadRequestHintsBuilder { - nullifier_tree: NonEmptyMerkleTree, + nullifier_tree: NonEmptyMerkleTree, non_membership_hints: BoundedVec, read_values: BoundedVec, - pending_nullifiers: [Nullifier; MAX_NEW_NULLIFIERS_PER_TX], + pending_nullifiers: [Nullifier; MAX_NULLIFIERS_PER_TX], } impl NullifierNonExistentReadRequestHintsBuilder { @@ -22,18 +22,18 @@ impl NullifierNonExistentReadRequestHintsBuilder { nullifier_tree: NonEmptyMerkleTree::empty(), non_membership_hints: BoundedVec::new(), read_values: BoundedVec::new(), - pending_nullifiers: [Nullifier::empty(); MAX_NEW_NULLIFIERS_PER_TX] + pending_nullifiers: [Nullifier::empty(); MAX_NULLIFIERS_PER_TX] } } pub fn set_nullifier_tree( &mut self, - tree: NonEmptyMerkleTree + tree: NonEmptyMerkleTree ) { self.nullifier_tree = tree; } - pub fn set_nullifiers(&mut self, nullifiers: [Nullifier; MAX_NEW_NULLIFIERS_PER_TX]) { + pub fn set_nullifiers(&mut self, nullifiers: [Nullifier; MAX_NULLIFIERS_PER_TX]) { self.pending_nullifiers = nullifiers; } diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr index e9317e56105..0c2d7e31d48 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr @@ -20,10 +20,10 @@ use dep::types::{ }, constants::{ NOTE_HASH_SUBTREE_SIBLING_PATH_LENGTH, NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, - PUBLIC_DATA_TREE_HEIGHT, NOTE_HASH_SUBTREE_HEIGHT, MAX_NEW_NOTE_HASHES_PER_TX, - MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_PUBLIC_DATA_READS_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, MAX_NEW_L2_TO_L1_MSGS_PER_TX, NULLIFIER_SUBTREE_HEIGHT, - NULLIFIER_TREE_HEIGHT, PUBLIC_DATA_SUBTREE_SIBLING_PATH_LENGTH, PUBLIC_DATA_SUBTREE_HEIGHT, + PUBLIC_DATA_TREE_HEIGHT, NOTE_HASH_SUBTREE_HEIGHT, MAX_NOTE_HASHES_PER_TX, + MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_PUBLIC_DATA_READS_PER_TX, MAX_NULLIFIERS_PER_TX, + MAX_L2_TO_L1_MSGS_PER_TX, NULLIFIER_SUBTREE_HEIGHT, NULLIFIER_TREE_HEIGHT, + PUBLIC_DATA_SUBTREE_SIBLING_PATH_LENGTH, PUBLIC_DATA_SUBTREE_HEIGHT, PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, ARCHIVE_HEIGHT, GAS_TOKEN_ADDRESS, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX }, @@ -145,13 +145,13 @@ impl BaseRollupInputs { // TODO(Kev): This should say calculate_commitments_subtree_root // Cpp code says calculate_commitments_subtree, so I'm leaving it as is for now fn calculate_commitments_subtree(self) -> Field { - calculate_subtree_root(self.kernel_data.public_inputs.end.new_note_hashes) + calculate_subtree_root(self.kernel_data.public_inputs.end.note_hashes) } fn check_nullifier_tree_non_membership_and_insert_to_tree(self) -> AppendOnlyTreeSnapshot { indexed_tree::batch_insert( self.start.nullifier_tree, - self.kernel_data.public_inputs.end.new_nullifiers, + self.kernel_data.public_inputs.end.nullifiers, self.state_diff_hints.sorted_nullifiers, self.state_diff_hints.sorted_nullifier_indexes, self.state_diff_hints.nullifier_subtree_sibling_path, @@ -410,7 +410,7 @@ fn compute_fee_payer_gas_token_balance_leaf_slot(fee_payer: AztecAddress) -> Fie #[test] fn consistent_not_hash_subtree_width() { assert_eq( - MAX_NEW_NOTE_HASHES_PER_TX as Field, 2.pow_32(NOTE_HASH_SUBTREE_HEIGHT as Field), "note hash subtree width is incorrect" + MAX_NOTE_HASHES_PER_TX as Field, 2.pow_32(NOTE_HASH_SUBTREE_HEIGHT as Field), "note hash subtree width is incorrect" ); } @@ -455,12 +455,11 @@ mod tests { address::{AztecAddress, EthAddress}, constants::{ ARCHIVE_HEIGHT, MAX_PUBLIC_DATA_READS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, - MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, NOTE_HASH_SUBTREE_SIBLING_PATH_LENGTH, + MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, NOTE_HASH_SUBTREE_SIBLING_PATH_LENGTH, NOTE_HASH_TREE_HEIGHT, NOTE_HASH_SUBTREE_HEIGHT, NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, NULLIFIER_TREE_HEIGHT, NULLIFIER_SUBTREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT, - PUBLIC_DATA_SUBTREE_HEIGHT, PUBLIC_DATA_SUBTREE_SIBLING_PATH_LENGTH, - MAX_NEW_L2_TO_L1_MSGS_PER_TX, PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, - MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX + PUBLIC_DATA_SUBTREE_HEIGHT, PUBLIC_DATA_SUBTREE_SIBLING_PATH_LENGTH, MAX_L2_TO_L1_MSGS_PER_TX, + PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX }, contract_class_id::ContractClassId, partial_state_reference::PartialStateReference, public_data_tree_leaf::PublicDataTreeLeaf, @@ -478,7 +477,7 @@ mod tests { value: Field, } - global MAX_NEW_NULLIFIERS_PER_TEST = 4; + global MAX_nullifiers_PER_TEST = 4; global MAX_PUBLIC_DATA_READS_PER_TEST = 2; fn update_public_data_tree( @@ -571,8 +570,8 @@ mod tests { struct BaseRollupInputsBuilder { kernel_data: FixtureBuilder, - pre_existing_notes: [Field; MAX_NEW_NOTE_HASHES_PER_TX], - pre_existing_nullifiers: [NullifierLeafPreimage; MAX_NEW_NULLIFIERS_PER_TX], + pre_existing_notes: [Field; MAX_NOTE_HASHES_PER_TX], + pre_existing_nullifiers: [NullifierLeafPreimage; MAX_NULLIFIERS_PER_TX], pre_existing_contracts: [Field; 2], pre_existing_public_data: [PublicDataTreeLeafPreimage; MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX], pre_existing_blocks: [Field; 2], @@ -583,7 +582,7 @@ mod tests { protocol_public_data_writes: BoundedVec<(u32, PublicDataTreeLeaf), PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX>, // Public data writes after processing by the base rollup circuit (defaults to public_data_writes ++ protocol_public_data_writes if empty) final_public_data_writes: BoundedVec<(u32, PublicDataTreeLeaf), MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX>, - new_nullifiers: BoundedVec, + nullifiers: BoundedVec, constants: ConstantRollupData, // Index of the item in the pre_existing_public_data array that contains the fee payer's gas token balance. // Used for building the public data hint read for the payment update request. If set to none, no hint is built. @@ -640,23 +639,23 @@ mod tests { fn update_nullifier_tree_with_new_leaves( mut self, - nullifier_tree: &mut NonEmptyMerkleTree, + nullifier_tree: &mut NonEmptyMerkleTree, kernel_data: &mut KernelData, start_nullifier_tree_snapshot: AppendOnlyTreeSnapshot - ) -> ([NullifierLeafPreimage; MAX_NEW_NULLIFIERS_PER_TX], [MembershipWitness; MAX_NEW_NULLIFIERS_PER_TX], [Field; MAX_NEW_NULLIFIERS_PER_TX], [u32; MAX_NEW_NULLIFIERS_PER_TX]) { - let mut nullifier_predecessor_preimages = [NullifierLeafPreimage::empty(); MAX_NEW_NULLIFIERS_PER_TX]; - let mut low_nullifier_membership_witness = [MembershipWitness::empty(); MAX_NEW_NULLIFIERS_PER_TX]; + ) -> ([NullifierLeafPreimage; MAX_NULLIFIERS_PER_TX], [MembershipWitness; MAX_NULLIFIERS_PER_TX], [Field; MAX_NULLIFIERS_PER_TX], [u32; MAX_NULLIFIERS_PER_TX]) { + let mut nullifier_predecessor_preimages = [NullifierLeafPreimage::empty(); MAX_NULLIFIERS_PER_TX]; + let mut low_nullifier_membership_witness = [MembershipWitness::empty(); MAX_NULLIFIERS_PER_TX]; let sorted_new_nullifier_tuples = sort_high_to_low( - self.new_nullifiers.storage.map(|insertion: NullifierInsertion| insertion.value), + self.nullifiers.storage.map(|insertion: NullifierInsertion| insertion.value), full_field_less_than ); - let mut sorted_nullifiers = [0; MAX_NEW_NULLIFIERS_PER_TX]; - let mut sorted_nullifiers_indexes = [0; MAX_NEW_NULLIFIERS_PER_TX]; + let mut sorted_nullifiers = [0; MAX_NULLIFIERS_PER_TX]; + let mut sorted_nullifiers_indexes = [0; MAX_NULLIFIERS_PER_TX]; - for i in 0..MAX_NEW_NULLIFIERS_PER_TX { - if (i as u32) < (MAX_NEW_NULLIFIERS_PER_TEST as u32) { + for i in 0..MAX_NULLIFIERS_PER_TX { + if (i as u32) < (MAX_nullifiers_PER_TEST as u32) { sorted_nullifiers[i] = sorted_new_nullifier_tuples[i].value; sorted_nullifiers_indexes[i] = sorted_new_nullifier_tuples[i].original_index; } else { @@ -667,15 +666,15 @@ mod tests { let mut pre_existing_nullifiers = self.pre_existing_nullifiers; - for i in 0..MAX_NEW_NULLIFIERS_PER_TEST { - if i < self.new_nullifiers.len() { + for i in 0..MAX_nullifiers_PER_TEST { + if i < self.nullifiers.len() { let sorted_tuple = sorted_new_nullifier_tuples[i]; let new_nullifier = sorted_tuple.value; let original_index = sorted_tuple.original_index; - let low_index = self.new_nullifiers.get_unchecked(original_index).existing_index; + let low_index = self.nullifiers.get_unchecked(original_index).existing_index; - kernel_data.public_inputs.end.new_nullifiers[original_index] = new_nullifier; + kernel_data.public_inputs.end.nullifiers[original_index] = new_nullifier; let mut low_preimage = pre_existing_nullifiers[low_index]; nullifier_predecessor_preimages[i] = low_preimage; @@ -831,8 +830,8 @@ mod tests { fn empty() -> Self { BaseRollupInputsBuilder { kernel_data: FixtureBuilder::new(), - pre_existing_notes: [0; MAX_NEW_NOTE_HASHES_PER_TX], - pre_existing_nullifiers: [NullifierLeafPreimage::empty(); MAX_NEW_NULLIFIERS_PER_TX], + pre_existing_notes: [0; MAX_NOTE_HASHES_PER_TX], + pre_existing_nullifiers: [NullifierLeafPreimage::empty(); MAX_NULLIFIERS_PER_TX], pre_existing_contracts: [0; 2], pre_existing_public_data: [PublicDataTreeLeafPreimage::empty(); MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX], pre_existing_blocks: [0; 2], @@ -840,7 +839,7 @@ mod tests { public_data_writes: BoundedVec::new(), protocol_public_data_writes: BoundedVec::new(), final_public_data_writes: BoundedVec::new(), - new_nullifiers: BoundedVec::new(), + nullifiers: BoundedVec::new(), constants: ConstantRollupData::empty(), fee_payer_gas_token_balance_pre_existing_public_data_index: Option::none() } @@ -848,33 +847,30 @@ mod tests { } #[test] - unconstrained fn new_note_hashes_tree() { + unconstrained fn note_hashes_tree() { let mut builder = BaseRollupInputsBuilder::new(); - let new_note_hashes = [27, 28, 29, 30, 31, 32]; - for i in 0..new_note_hashes.len() { - builder.kernel_data.add_new_note_hash(new_note_hashes[i], 0); + let note_hashes = [27, 28, 29, 30, 31, 32]; + for i in 0..note_hashes.len() { + builder.kernel_data.add_new_note_hash(note_hashes[i], 0); } let mut expected_commitments_tree = NonEmptyMerkleTree::new( - [0; MAX_NEW_NOTE_HASHES_PER_TX * 2], + [0; MAX_NOTE_HASHES_PER_TX * 2], [0; NOTE_HASH_TREE_HEIGHT], [0; NOTE_HASH_TREE_HEIGHT - NOTE_HASH_SUBTREE_HEIGHT - 1], [0; NOTE_HASH_SUBTREE_HEIGHT + 1] ); let outputs = builder.execute(); - let expected_start_note_hash_tree_snapshot = AppendOnlyTreeSnapshot { - root: expected_commitments_tree.get_root(), - next_available_leaf_index: MAX_NEW_NOTE_HASHES_PER_TX as u32 - }; + let expected_start_note_hash_tree_snapshot = AppendOnlyTreeSnapshot { root: expected_commitments_tree.get_root(), next_available_leaf_index: MAX_NOTE_HASHES_PER_TX as u32 }; assert(outputs.start.note_hash_tree.eq(expected_start_note_hash_tree_snapshot)); - for i in 0..new_note_hashes.len() { - expected_commitments_tree.update_leaf(i + MAX_NEW_NOTE_HASHES_PER_TX, new_note_hashes[i]); + for i in 0..note_hashes.len() { + expected_commitments_tree.update_leaf(i + MAX_NOTE_HASHES_PER_TX, note_hashes[i]); } let expected_end_note_hash_tree_snapshot = AppendOnlyTreeSnapshot { root: expected_commitments_tree.get_root(), - next_available_leaf_index: (MAX_NEW_NOTE_HASHES_PER_TX * 2) as u32 + next_available_leaf_index: (MAX_NOTE_HASHES_PER_TX * 2) as u32 }; assert(outputs.end.note_hash_tree.eq(expected_end_note_hash_tree_snapshot)); } @@ -921,15 +917,15 @@ mod tests { next_index : 0, }; - builder.new_nullifiers.push(NullifierInsertion { existing_index: 0, value: 1 }); - let mut tree_nullifiers = [NullifierLeafPreimage::empty(); MAX_NEW_NULLIFIERS_PER_TX * 2]; + builder.nullifiers.push(NullifierInsertion { existing_index: 0, value: 1 }); + let mut tree_nullifiers = [NullifierLeafPreimage::empty(); MAX_NULLIFIERS_PER_TX * 2]; tree_nullifiers[0] = NullifierLeafPreimage { nullifier : 0, next_nullifier : 1, - next_index : MAX_NEW_NULLIFIERS_PER_TX, + next_index : MAX_NULLIFIERS_PER_TX, }; tree_nullifiers[1] = builder.pre_existing_nullifiers[1]; - tree_nullifiers[MAX_NEW_NULLIFIERS_PER_TX] = NullifierLeafPreimage { + tree_nullifiers[MAX_NULLIFIERS_PER_TX] = NullifierLeafPreimage { nullifier : 1, next_nullifier : 7, next_index : 1, @@ -946,7 +942,7 @@ mod tests { assert( output.end.nullifier_tree.eq( - AppendOnlyTreeSnapshot { root: end_nullifier_tree.get_root(), next_available_leaf_index: 2 * MAX_NEW_NULLIFIERS_PER_TX as u32 } + AppendOnlyTreeSnapshot { root: end_nullifier_tree.get_root(), next_available_leaf_index: 2 * MAX_NULLIFIERS_PER_TX as u32 } ) ); } @@ -966,30 +962,30 @@ mod tests { next_index : 0, }; - builder.new_nullifiers.push(NullifierInsertion { existing_index: 1, value: 8 }); - for i in 1..builder.new_nullifiers.max_len() { - builder.new_nullifiers.push(NullifierInsertion { existing_index: 1, value: (8 + i) as Field }); + builder.nullifiers.push(NullifierInsertion { existing_index: 1, value: 8 }); + for i in 1..builder.nullifiers.max_len() { + builder.nullifiers.push(NullifierInsertion { existing_index: 1, value: (8 + i) as Field }); } let output = builder.execute(); - let mut tree_nullifiers = [NullifierLeafPreimage::empty(); MAX_NEW_NULLIFIERS_PER_TX * 2]; + let mut tree_nullifiers = [NullifierLeafPreimage::empty(); MAX_NULLIFIERS_PER_TX * 2]; tree_nullifiers[0] = builder.pre_existing_nullifiers[0]; tree_nullifiers[1] = NullifierLeafPreimage { nullifier : 7, next_nullifier : 8, - next_index : MAX_NEW_NULLIFIERS_PER_TX, + next_index : MAX_NULLIFIERS_PER_TX, }; - let last_index = builder.new_nullifiers.max_len() - 1; + let last_index = builder.nullifiers.max_len() - 1; for i in 0..last_index { - tree_nullifiers[MAX_NEW_NULLIFIERS_PER_TX + i] = NullifierLeafPreimage { + tree_nullifiers[MAX_NULLIFIERS_PER_TX + i] = NullifierLeafPreimage { nullifier : (8 + i) as Field, next_nullifier : (8 + i + 1) as Field, - next_index : MAX_NEW_NULLIFIERS_PER_TX + i + 1, + next_index : MAX_NULLIFIERS_PER_TX + i + 1, }; } - tree_nullifiers[MAX_NEW_NULLIFIERS_PER_TX+last_index] = NullifierLeafPreimage { + tree_nullifiers[MAX_NULLIFIERS_PER_TX+last_index] = NullifierLeafPreimage { nullifier : (8 + last_index) as Field, next_nullifier : 0, next_index : 0, @@ -1004,7 +1000,7 @@ mod tests { assert( output.end.nullifier_tree.eq( - AppendOnlyTreeSnapshot { root: end_nullifier_tree.get_root(), next_available_leaf_index: 2 * MAX_NEW_NULLIFIERS_PER_TX as u32 } + AppendOnlyTreeSnapshot { root: end_nullifier_tree.get_root(), next_available_leaf_index: 2 * MAX_NULLIFIERS_PER_TX as u32 } ) ); } @@ -1024,8 +1020,8 @@ mod tests { next_index : 0, }; - builder.new_nullifiers.push(NullifierInsertion { existing_index: 1, value: 8 }); - builder.new_nullifiers.push(NullifierInsertion { existing_index: 1, value: 8 }); + builder.nullifiers.push(NullifierInsertion { existing_index: 1, value: 8 }); + builder.nullifiers.push(NullifierInsertion { existing_index: 1, value: 8 }); builder.fails(); } @@ -1045,8 +1041,8 @@ mod tests { next_index : 0, }; - builder.new_nullifiers.push(NullifierInsertion { existing_index: 1, value: 8 }); - builder.new_nullifiers.push(NullifierInsertion { existing_index: 1, value: 8 }); + builder.nullifiers.push(NullifierInsertion { existing_index: 1, value: 8 }); + builder.nullifiers.push(NullifierInsertion { existing_index: 1, value: 8 }); builder.fails(); } @@ -1075,13 +1071,13 @@ mod tests { #[test] unconstrained fn nonempty_block_out_hash() { let mut end = CombinedAccumulatedData::empty(); - for i in 0..MAX_NEW_L2_TO_L1_MSGS_PER_TX { - end.new_l2_to_l1_msgs[i] = 10 + i as Field; + for i in 0..MAX_L2_TO_L1_MSGS_PER_TX { + end.l2_to_l1_msgs[i] = 10 + i as Field; } let out_hash = compute_kernel_out_hash(end); // Since we fill the tree completely, we know to expect a full tree as below - let expected_tree = dep::types::merkle_tree::variable_merkle_tree::tests::generate_full_sha_tree(end.new_l2_to_l1_msgs); + let expected_tree = dep::types::merkle_tree::variable_merkle_tree::tests::generate_full_sha_tree(end.l2_to_l1_msgs); assert_eq(out_hash, expected_tree.get_root()); } diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/state_diff_hints.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/state_diff_hints.nr index a4479a8b917..91f2cc0a31b 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/state_diff_hints.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/state_diff_hints.nr @@ -1,19 +1,18 @@ use dep::types::{ abis::{nullifier_leaf_preimage::NullifierLeafPreimage}, constants::{ - MAX_NEW_NULLIFIERS_PER_TX, NOTE_HASH_SUBTREE_SIBLING_PATH_LENGTH, - NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, PUBLIC_DATA_SUBTREE_SIBLING_PATH_LENGTH, - NULLIFIER_TREE_HEIGHT + MAX_NULLIFIERS_PER_TX, NOTE_HASH_SUBTREE_SIBLING_PATH_LENGTH, NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, + PUBLIC_DATA_SUBTREE_SIBLING_PATH_LENGTH, NULLIFIER_TREE_HEIGHT }, merkle_tree::MembershipWitness }; struct StateDiffHints { - nullifier_predecessor_preimages: [NullifierLeafPreimage; MAX_NEW_NULLIFIERS_PER_TX], - nullifier_predecessor_membership_witnesses: [MembershipWitness; MAX_NEW_NULLIFIERS_PER_TX], + nullifier_predecessor_preimages: [NullifierLeafPreimage; MAX_NULLIFIERS_PER_TX], + nullifier_predecessor_membership_witnesses: [MembershipWitness; MAX_NULLIFIERS_PER_TX], - sorted_nullifiers: [Field; MAX_NEW_NULLIFIERS_PER_TX], - sorted_nullifier_indexes: [u32; MAX_NEW_NULLIFIERS_PER_TX], + sorted_nullifiers: [Field; MAX_NULLIFIERS_PER_TX], + sorted_nullifier_indexes: [u32; MAX_NULLIFIERS_PER_TX], // For inserting the new subtrees into their respective trees: // Note: the insertion leaf index can be derived from the snapshots' `next_available_leaf_index` values (tree diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/components.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/components.nr index 4653d57bae0..78a138dd4f3 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/components.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/components.nr @@ -3,7 +3,7 @@ use crate::abis::previous_rollup_data::PreviousRollupData; use dep::types::{ hash::accumulate_sha256, merkle_tree::VariableMerkleTree, constants::{ - MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, MAX_NEW_L2_TO_L1_MSGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX }, @@ -91,8 +91,8 @@ pub fn compute_out_hash(previous_rollup_data: [PreviousRollupData; 2]) -> Field } pub fn compute_kernel_out_hash(combined: CombinedAccumulatedData) -> Field { - let non_empty_items = array_length(combined.new_l2_to_l1_msgs); - let merkle_tree = VariableMerkleTree::new_sha(combined.new_l2_to_l1_msgs, non_empty_items); + let non_empty_items = array_length(combined.l2_to_l1_msgs); + let merkle_tree = VariableMerkleTree::new_sha(combined.l2_to_l1_msgs, non_empty_items); merkle_tree.get_root() } @@ -114,9 +114,9 @@ pub fn compute_txs_effects_hash(previous_rollup_data: [PreviousRollupData; 2]) - // Tx effects hash consists of // 1 field for revert code // 1 field for transaction fee -// MAX_NEW_NOTE_HASHES_PER_TX fields for note hashes -// MAX_NEW_NULLIFIERS_PER_TX fields for nullifiers -// MAX_NEW_L2_TO_L1_MSGS_PER_TX fields for L2 to L1 messages +// MAX_NOTE_HASHES_PER_TX fields for note hashes +// MAX_NULLIFIERS_PER_TX fields for nullifiers +// MAX_L2_TO_L1_MSGS_PER_TX fields for L2 to L1 messages // MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX public data update requests -> MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * 2 fields // __ // 1 note encrypted logs length --> 1 field | @@ -126,7 +126,7 @@ pub fn compute_txs_effects_hash(previous_rollup_data: [PreviousRollupData; 2]) - // 1 note encrypted logs hash --> 1 sha256 hash -> 31 bytes -> 1 fields | Beware when populating bytes that we fill (prepend) to 32! | // 1 encrypted logs hash --> 1 sha256 hash -> 31 bytes -> 1 fields | Beware when populating bytes that we fill (prepend) to 32! | -> 3 types of logs - 3 fields for its hashes // 1 unencrypted logs hash --> 1 sha256 hash -> 31 bytes -> 1 fields | Beware when populating bytes that we fill (prepend) to 32! __| -global TX_EFFECTS_HASH_INPUT_FIELDS = 1 + 1 + MAX_NEW_NOTE_HASHES_PER_TX + MAX_NEW_NULLIFIERS_PER_TX + MAX_NEW_L2_TO_L1_MSGS_PER_TX + MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * 2 + 3 + 3; +global TX_EFFECTS_HASH_INPUT_FIELDS = 1 + 1 + MAX_NOTE_HASHES_PER_TX + MAX_NULLIFIERS_PER_TX + MAX_L2_TO_L1_MSGS_PER_TX + MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * 2 + 3 + 3; // Computes the tx effects hash for a base rollup (a single transaction) // TODO(Alvaro): This is too slow for brillig without the array optimization @@ -138,9 +138,9 @@ pub fn compute_tx_effects_hash( ) -> Field { let mut tx_effects_hash_input = [0; TX_EFFECTS_HASH_INPUT_FIELDS]; - let new_note_hashes = combined.new_note_hashes; - let new_nullifiers = combined.new_nullifiers; - let new_l2_to_l1_msgs = combined.new_l2_to_l1_msgs; + let note_hashes = combined.note_hashes; + let nullifiers = combined.nullifiers; + let l2_to_l1_msgs = combined.l2_to_l1_msgs; // Public writes are the concatenation of all non-empty user update requests and protocol update requests, then padded with zeroes. // The incoming all_public_data_update_requests may have empty update requests in the middle, so we move those to the end of the array. @@ -164,22 +164,22 @@ pub fn compute_tx_effects_hash( offset += 1; // NOTE HASHES - for j in 0..MAX_NEW_NOTE_HASHES_PER_TX { - tx_effects_hash_input[offset + j] = new_note_hashes[j]; + for j in 0..MAX_NOTE_HASHES_PER_TX { + tx_effects_hash_input[offset + j] = note_hashes[j]; } - offset += MAX_NEW_NOTE_HASHES_PER_TX ; + offset += MAX_NOTE_HASHES_PER_TX ; // NULLIFIERS - for j in 0..MAX_NEW_NULLIFIERS_PER_TX { - tx_effects_hash_input[offset + j] = new_nullifiers[j]; + for j in 0..MAX_NULLIFIERS_PER_TX { + tx_effects_hash_input[offset + j] = nullifiers[j]; } - offset += MAX_NEW_NULLIFIERS_PER_TX ; + offset += MAX_NULLIFIERS_PER_TX ; // L2 TO L1 MESSAGES - for j in 0..MAX_NEW_L2_TO_L1_MSGS_PER_TX { - tx_effects_hash_input[offset + j] = new_l2_to_l1_msgs[j]; + for j in 0..MAX_L2_TO_L1_MSGS_PER_TX { + tx_effects_hash_input[offset + j] = l2_to_l1_msgs[j]; } - offset += MAX_NEW_L2_TO_L1_MSGS_PER_TX; + offset += MAX_L2_TO_L1_MSGS_PER_TX; // PUBLIC DATA UPDATE REQUESTS for j in 0..MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX { @@ -242,10 +242,10 @@ fn get_all_update_requests_for_tx_effects(all_public_data_update_requests: [Publ fn consistent_TX_EFFECTS_HASH_INPUT_FIELDS() { let expected_size = 1 // revert code + 1 // transaction fee - + MAX_NEW_NOTE_HASHES_PER_TX - + MAX_NEW_NULLIFIERS_PER_TX + + MAX_NOTE_HASHES_PER_TX + + MAX_NULLIFIERS_PER_TX + MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * 2 - + MAX_NEW_L2_TO_L1_MSGS_PER_TX + + MAX_L2_TO_L1_MSGS_PER_TX + 3 // logs lengths + 3; // logs hashes assert(TX_EFFECTS_HASH_INPUT_FIELDS == expected_size, "tx effects hash input size is incorrect"); diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/root/root_rollup_inputs.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/root/root_rollup_inputs.nr index 512e46b78e0..365d288359c 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/root/root_rollup_inputs.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/root/root_rollup_inputs.nr @@ -21,8 +21,8 @@ struct RootRollupInputs { l1_to_l2_roots: RootRollupParityInput, // inputs required to process l1 to l2 messages - new_l1_to_l2_messages : [Field; NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP], - new_l1_to_l2_message_tree_root_sibling_path : [Field; L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH], + l1_to_l2_messages : [Field; NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP], + l1_to_l2_message_subtree_sibling_path : [Field; L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH], start_l1_to_l2_message_tree_snapshot : AppendOnlyTreeSnapshot, @@ -51,7 +51,7 @@ impl RootRollupInputs { let empty_l1_to_l2_subtree_root = calculate_empty_tree_root(L1_TO_L2_MSG_SUBTREE_HEIGHT); let new_l1_to_l2_message_tree_snapshot = append_only_tree::insert_subtree_to_snapshot_tree( self.start_l1_to_l2_message_tree_snapshot, - self.new_l1_to_l2_message_tree_root_sibling_path, + self.l1_to_l2_message_subtree_sibling_path, empty_l1_to_l2_subtree_root, self.l1_to_l2_roots.public_inputs.converted_root, // TODO(Kev): For now we can add a test that this fits inside of @@ -99,8 +99,8 @@ impl Empty for RootRollupInputs { RootRollupInputs { previous_rollup_data : [PreviousRollupData::empty(); 2], l1_to_l2_roots: RootRollupParityInput::empty(), - new_l1_to_l2_messages : [0; NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP], - new_l1_to_l2_message_tree_root_sibling_path : [0; L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH], + l1_to_l2_messages : [0; NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP], + l1_to_l2_message_subtree_sibling_path : [0; L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH], start_l1_to_l2_message_tree_snapshot : AppendOnlyTreeSnapshot::zero(), start_archive_snapshot : AppendOnlyTreeSnapshot::zero(), new_archive_sibling_path : [0; ARCHIVE_HEIGHT], diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tests/root_rollup_inputs.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tests/root_rollup_inputs.nr index 03ac395b32d..fec7e28ec22 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tests/root_rollup_inputs.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tests/root_rollup_inputs.nr @@ -11,15 +11,15 @@ use crate::tests::previous_rollup_data::default_previous_rollup_data; pub fn compute_l1_l2_empty_snapshot() -> (AppendOnlyTreeSnapshot, [Field; L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH]) { let zero_hashes = compute_zero_hashes([0; L1_TO_L2_MSG_TREE_HEIGHT]); - let mut new_l1_to_l2_message_tree_root_sibling_path = [0; L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH]; + let mut l1_to_l2_message_subtree_sibling_path = [0; L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH]; for i in 0..L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH { let index = L1_TO_L2_MSG_SUBTREE_HEIGHT + i - 1; - new_l1_to_l2_message_tree_root_sibling_path[i] = zero_hashes[index]; + l1_to_l2_message_subtree_sibling_path[i] = zero_hashes[index]; } ( - AppendOnlyTreeSnapshot { root: zero_hashes[zero_hashes.len() - 1], next_available_leaf_index: 0 }, new_l1_to_l2_message_tree_root_sibling_path + AppendOnlyTreeSnapshot { root: zero_hashes[zero_hashes.len() - 1], next_available_leaf_index: 0 }, l1_to_l2_message_subtree_sibling_path ) } @@ -38,7 +38,7 @@ pub fn default_root_rollup_inputs() -> RootRollupInputs { let mut inputs = RootRollupInputs::empty(); let (l1_l2_empty_snapshot, l1_l2_empty_sibling_path) = compute_l1_l2_empty_snapshot(); - inputs.new_l1_to_l2_message_tree_root_sibling_path = l1_l2_empty_sibling_path; + inputs.l1_to_l2_message_subtree_sibling_path = l1_l2_empty_sibling_path; inputs.start_l1_to_l2_message_tree_snapshot = l1_l2_empty_snapshot; let (blocks_snapshot, blocks_sibling_path) = compute_archive_snapshot(); diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/combined_accumulated_data.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/combined_accumulated_data.nr index f23ee1363c4..9f0cbf36b2d 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/combined_accumulated_data.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/combined_accumulated_data.nr @@ -6,7 +6,7 @@ use crate::{ log_hash::{LogHash, NoteLogHash}, gas::Gas, side_effect::{Ordered, Positioned} }, constants::{ - MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, MAX_NEW_L2_TO_L1_MSGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, COMBINED_ACCUMULATED_DATA_LENGTH, MAX_UNENCRYPTED_LOGS_PER_TX }, @@ -15,8 +15,8 @@ use crate::{ }; struct CombineHints { - sorted_note_hashes: [NoteHash; MAX_NEW_NOTE_HASHES_PER_TX], - sorted_note_hashes_indexes: [u32; MAX_NEW_NOTE_HASHES_PER_TX], + sorted_note_hashes: [NoteHash; MAX_NOTE_HASHES_PER_TX], + sorted_note_hashes_indexes: [u32; MAX_NOTE_HASHES_PER_TX], sorted_unencrypted_logs_hashes: [LogHash; MAX_UNENCRYPTED_LOGS_PER_TX], sorted_unencrypted_logs_hashes_indexes: [u32; MAX_UNENCRYPTED_LOGS_PER_TX], // the public data update requests are sorted by their leaf index AND counter @@ -28,9 +28,9 @@ struct CombineHints { } struct CombinedAccumulatedData { - new_note_hashes: [Field; MAX_NEW_NOTE_HASHES_PER_TX], - new_nullifiers: [Field; MAX_NEW_NULLIFIERS_PER_TX], - new_l2_to_l1_msgs: [Field; MAX_NEW_L2_TO_L1_MSGS_PER_TX], + note_hashes: [Field; MAX_NOTE_HASHES_PER_TX], + nullifiers: [Field; MAX_NULLIFIERS_PER_TX], + l2_to_l1_msgs: [Field; MAX_L2_TO_L1_MSGS_PER_TX], note_encrypted_logs_hash: Field, encrypted_logs_hash: Field, @@ -57,7 +57,7 @@ impl CombinedAccumulatedData { revertible: PublicAccumulatedData, combine_hints: CombineHints ) -> Self { - let merged_note_hashes = array_merge(non_revertible.new_note_hashes, revertible.new_note_hashes); + let merged_note_hashes = array_merge(non_revertible.note_hashes, revertible.note_hashes); assert_sorted_array( merged_note_hashes, combine_hints.sorted_note_hashes, @@ -116,12 +116,9 @@ impl CombinedAccumulatedData { let unencrypted_log_preimages_length = non_revertible.unencrypted_logs_hashes.fold(0, |a, b: LogHash| a + b.length) + revertible.unencrypted_logs_hashes.fold(0, |a, b: LogHash| a + b.length); CombinedAccumulatedData { - new_note_hashes: combine_hints.sorted_note_hashes.map(|n: NoteHash| n.value), - new_nullifiers: array_merge(non_revertible.new_nullifiers, revertible.new_nullifiers).map(|n: Nullifier| n.value), - new_l2_to_l1_msgs: array_merge( - non_revertible.new_l2_to_l1_msgs, - revertible.new_l2_to_l1_msgs - ), + note_hashes: combine_hints.sorted_note_hashes.map(|n: NoteHash| n.value), + nullifiers: array_merge(non_revertible.nullifiers, revertible.nullifiers).map(|n: Nullifier| n.value), + l2_to_l1_msgs: array_merge(non_revertible.l2_to_l1_msgs, revertible.l2_to_l1_msgs), note_encrypted_logs_hash, encrypted_logs_hash, unencrypted_logs_hash, @@ -137,9 +134,9 @@ impl CombinedAccumulatedData { impl Empty for CombinedAccumulatedData { fn empty() -> Self { CombinedAccumulatedData { - new_note_hashes: [0; MAX_NEW_NOTE_HASHES_PER_TX], - new_nullifiers: [0; MAX_NEW_NULLIFIERS_PER_TX], - new_l2_to_l1_msgs: [0; MAX_NEW_L2_TO_L1_MSGS_PER_TX], + note_hashes: [0; MAX_NOTE_HASHES_PER_TX], + nullifiers: [0; MAX_NULLIFIERS_PER_TX], + l2_to_l1_msgs: [0; MAX_L2_TO_L1_MSGS_PER_TX], note_encrypted_logs_hash: 0, encrypted_logs_hash: 0, unencrypted_logs_hash: 0, @@ -156,9 +153,9 @@ impl Serialize for CombinedAccumulatedData { fn serialize(self) -> [Field; COMBINED_ACCUMULATED_DATA_LENGTH] { let mut fields: BoundedVec = BoundedVec::new(); - fields.extend_from_array(self.new_note_hashes); - fields.extend_from_array(self.new_nullifiers); - fields.extend_from_array(self.new_l2_to_l1_msgs); + fields.extend_from_array(self.note_hashes); + fields.extend_from_array(self.nullifiers); + fields.extend_from_array(self.l2_to_l1_msgs); fields.push(self.note_encrypted_logs_hash); fields.push(self.encrypted_logs_hash); fields.push(self.unencrypted_logs_hash); @@ -183,9 +180,9 @@ impl Deserialize for CombinedAccumulatedData { let mut reader = Reader::new(fields); let item = CombinedAccumulatedData { - new_note_hashes: reader.read_array([0; MAX_NEW_NOTE_HASHES_PER_TX]), - new_nullifiers: reader.read_array([0; MAX_NEW_NULLIFIERS_PER_TX]), - new_l2_to_l1_msgs: reader.read_array([0; MAX_NEW_L2_TO_L1_MSGS_PER_TX]), + note_hashes: reader.read_array([0; MAX_NOTE_HASHES_PER_TX]), + nullifiers: reader.read_array([0; MAX_NULLIFIERS_PER_TX]), + l2_to_l1_msgs: reader.read_array([0; MAX_L2_TO_L1_MSGS_PER_TX]), note_encrypted_logs_hash: reader.read(), encrypted_logs_hash: reader.read(), unencrypted_logs_hash: reader.read(), @@ -202,9 +199,9 @@ impl Deserialize for CombinedAccumulatedData { impl Eq for CombinedAccumulatedData { fn eq(self, other: Self) -> bool { - (self.new_note_hashes == other.new_note_hashes) & - (self.new_nullifiers == other.new_nullifiers) & - (self.new_l2_to_l1_msgs == other.new_l2_to_l1_msgs) & + (self.note_hashes == other.note_hashes) & + (self.nullifiers == other.nullifiers) & + (self.l2_to_l1_msgs == other.l2_to_l1_msgs) & (self.note_encrypted_logs_hash == other.note_encrypted_logs_hash) & (self.encrypted_logs_hash == other.encrypted_logs_hash) & (self.unencrypted_logs_hash == other.unencrypted_logs_hash) & diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/private_accumulated_data.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/private_accumulated_data.nr index 7e1eda7a572..fe849170757 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/private_accumulated_data.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/private_accumulated_data.nr @@ -8,15 +8,15 @@ use crate::{ utils::reader::Reader }; use crate::constants::{ - MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX, - MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, MAX_NEW_L2_TO_L1_MSGS_PER_TX, MAX_ENCRYPTED_LOGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX, + MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_ENCRYPTED_LOGS_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, PRIVATE_ACCUMULATED_DATA_LENGTH }; struct PrivateAccumulatedData { - new_note_hashes: [ScopedNoteHash; MAX_NEW_NOTE_HASHES_PER_TX], - new_nullifiers: [ScopedNullifier; MAX_NEW_NULLIFIERS_PER_TX], - new_l2_to_l1_msgs: [ScopedL2ToL1Message; MAX_NEW_L2_TO_L1_MSGS_PER_TX], + note_hashes: [ScopedNoteHash; MAX_NOTE_HASHES_PER_TX], + nullifiers: [ScopedNullifier; MAX_NULLIFIERS_PER_TX], + l2_to_l1_msgs: [ScopedL2ToL1Message; MAX_L2_TO_L1_MSGS_PER_TX], note_encrypted_logs_hashes: [NoteLogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], encrypted_logs_hashes: [ScopedEncryptedLogHash; MAX_ENCRYPTED_LOGS_PER_TX], @@ -30,16 +30,16 @@ impl Serialize for PrivateAccumulatedData { fn serialize(self) -> [Field; PRIVATE_ACCUMULATED_DATA_LENGTH] { let mut fields: BoundedVec = BoundedVec::new(); - for i in 0..MAX_NEW_NOTE_HASHES_PER_TX { - fields.extend_from_array(self.new_note_hashes[i].serialize()); + for i in 0..MAX_NOTE_HASHES_PER_TX { + fields.extend_from_array(self.note_hashes[i].serialize()); } - for i in 0..MAX_NEW_NULLIFIERS_PER_TX { - fields.extend_from_array(self.new_nullifiers[i].serialize()); + for i in 0..MAX_NULLIFIERS_PER_TX { + fields.extend_from_array(self.nullifiers[i].serialize()); } - for i in 0..MAX_NEW_L2_TO_L1_MSGS_PER_TX { - fields.extend_from_array(self.new_l2_to_l1_msgs[i].serialize()); + for i in 0..MAX_L2_TO_L1_MSGS_PER_TX { + fields.extend_from_array(self.l2_to_l1_msgs[i].serialize()); } for i in 0..MAX_NOTE_ENCRYPTED_LOGS_PER_TX { @@ -73,9 +73,9 @@ impl Deserialize for PrivateAccumulatedData { let mut reader = Reader::new(fields); let item = PrivateAccumulatedData { - new_note_hashes: reader.read_struct_array(ScopedNoteHash::deserialize, [ScopedNoteHash::empty(); MAX_NEW_NOTE_HASHES_PER_TX]), - new_nullifiers: reader.read_struct_array(ScopedNullifier::deserialize, [ScopedNullifier::empty(); MAX_NEW_NULLIFIERS_PER_TX]), - new_l2_to_l1_msgs: reader.read_struct_array(ScopedL2ToL1Message::deserialize, [ScopedL2ToL1Message::empty(); MAX_NEW_L2_TO_L1_MSGS_PER_TX]), + note_hashes: reader.read_struct_array(ScopedNoteHash::deserialize, [ScopedNoteHash::empty(); MAX_NOTE_HASHES_PER_TX]), + nullifiers: reader.read_struct_array(ScopedNullifier::deserialize, [ScopedNullifier::empty(); MAX_NULLIFIERS_PER_TX]), + l2_to_l1_msgs: reader.read_struct_array(ScopedL2ToL1Message::deserialize, [ScopedL2ToL1Message::empty(); MAX_L2_TO_L1_MSGS_PER_TX]), note_encrypted_logs_hashes: reader.read_struct_array(NoteLogHash::deserialize, [NoteLogHash::empty(); MAX_NOTE_ENCRYPTED_LOGS_PER_TX]), encrypted_logs_hashes: reader.read_struct_array(ScopedEncryptedLogHash::deserialize, [ScopedEncryptedLogHash::empty(); MAX_ENCRYPTED_LOGS_PER_TX]), unencrypted_logs_hashes: reader.read_struct_array(ScopedLogHash::deserialize, [ScopedLogHash::empty(); MAX_UNENCRYPTED_LOGS_PER_TX]), @@ -89,9 +89,9 @@ impl Deserialize for PrivateAccumulatedData { impl Eq for PrivateAccumulatedData { fn eq(self, other: Self) -> bool { - (self.new_note_hashes == other.new_note_hashes) & - (self.new_nullifiers == other.new_nullifiers) & - (self.new_l2_to_l1_msgs == other.new_l2_to_l1_msgs) & + (self.note_hashes == other.note_hashes) & + (self.nullifiers == other.nullifiers) & + (self.l2_to_l1_msgs == other.l2_to_l1_msgs) & (self.note_encrypted_logs_hashes == other.note_encrypted_logs_hashes) & (self.encrypted_logs_hashes == other.encrypted_logs_hashes) & (self.unencrypted_logs_hashes == other.unencrypted_logs_hashes) & @@ -103,9 +103,9 @@ impl Eq for PrivateAccumulatedData { impl Empty for PrivateAccumulatedData { fn empty() -> Self { PrivateAccumulatedData { - new_note_hashes: [ScopedNoteHash::empty(); MAX_NEW_NOTE_HASHES_PER_TX], - new_nullifiers: [ScopedNullifier::empty(); MAX_NEW_NULLIFIERS_PER_TX], - new_l2_to_l1_msgs: [ScopedL2ToL1Message::empty(); MAX_NEW_L2_TO_L1_MSGS_PER_TX], + note_hashes: [ScopedNoteHash::empty(); MAX_NOTE_HASHES_PER_TX], + nullifiers: [ScopedNullifier::empty(); MAX_NULLIFIERS_PER_TX], + l2_to_l1_msgs: [ScopedL2ToL1Message::empty(); MAX_L2_TO_L1_MSGS_PER_TX], note_encrypted_logs_hashes: [NoteLogHash::empty(); MAX_NOTE_ENCRYPTED_LOGS_PER_TX], encrypted_logs_hashes: [ScopedEncryptedLogHash::empty(); MAX_ENCRYPTED_LOGS_PER_TX], unencrypted_logs_hashes: [ScopedLogHash::empty(); MAX_UNENCRYPTED_LOGS_PER_TX], diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/private_accumulated_data_builder.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/private_accumulated_data_builder.nr index 56c79e0b693..5b90203eed5 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/private_accumulated_data_builder.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/private_accumulated_data_builder.nr @@ -6,17 +6,17 @@ use crate::{ log_hash::{ScopedEncryptedLogHash, NoteLogHash, ScopedLogHash} }, constants::{ - MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX, - MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, MAX_NEW_L2_TO_L1_MSGS_PER_TX, MAX_ENCRYPTED_LOGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX, + MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_ENCRYPTED_LOGS_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX }, messaging::l2_to_l1_message::ScopedL2ToL1Message, traits::Empty }; struct PrivateAccumulatedDataBuilder { - new_note_hashes: BoundedVec, - new_nullifiers: BoundedVec, - new_l2_to_l1_msgs: BoundedVec, + note_hashes: BoundedVec, + nullifiers: BoundedVec, + l2_to_l1_msgs: BoundedVec, note_encrypted_logs_hashes: BoundedVec, encrypted_logs_hashes: BoundedVec, @@ -30,9 +30,9 @@ struct PrivateAccumulatedDataBuilder { impl PrivateAccumulatedDataBuilder { pub fn finish(self) -> PrivateAccumulatedData { PrivateAccumulatedData { - new_note_hashes: self.new_note_hashes.storage, - new_nullifiers: self.new_nullifiers.storage, - new_l2_to_l1_msgs: self.new_l2_to_l1_msgs.storage, + note_hashes: self.note_hashes.storage, + nullifiers: self.nullifiers.storage, + l2_to_l1_msgs: self.l2_to_l1_msgs.storage, note_encrypted_logs_hashes: self.note_encrypted_logs_hashes.storage, encrypted_logs_hashes: self.encrypted_logs_hashes.storage, unencrypted_logs_hashes: self.unencrypted_logs_hashes.storage, @@ -45,9 +45,9 @@ impl PrivateAccumulatedDataBuilder { impl Empty for PrivateAccumulatedDataBuilder { fn empty() -> Self { PrivateAccumulatedDataBuilder { - new_note_hashes: BoundedVec::new(), - new_nullifiers: BoundedVec::new(), - new_l2_to_l1_msgs: BoundedVec::new(), + note_hashes: BoundedVec::new(), + nullifiers: BoundedVec::new(), + l2_to_l1_msgs: BoundedVec::new(), note_encrypted_logs_hashes: BoundedVec::new(), encrypted_logs_hashes: BoundedVec::new(), unencrypted_logs_hashes: BoundedVec::new(), diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data.nr index 7bdc889c3e4..ae6392b2386 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data.nr @@ -4,17 +4,17 @@ use crate::{ note_hash::NoteHash, nullifier::Nullifier, log_hash::{LogHash, NoteLogHash} }, constants::{ - MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, - MAX_NEW_L2_TO_L1_MSGS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_ENCRYPTED_LOGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, + MAX_L2_TO_L1_MSGS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_ENCRYPTED_LOGS_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, PUBLIC_ACCUMULATED_DATA_LENGTH }, traits::{Empty, Serialize, Deserialize}, utils::reader::Reader }; struct PublicAccumulatedData { - new_note_hashes: [NoteHash; MAX_NEW_NOTE_HASHES_PER_TX], - new_nullifiers: [Nullifier; MAX_NEW_NULLIFIERS_PER_TX], - new_l2_to_l1_msgs: [Field; MAX_NEW_L2_TO_L1_MSGS_PER_TX], + note_hashes: [NoteHash; MAX_NOTE_HASHES_PER_TX], + nullifiers: [Nullifier; MAX_NULLIFIERS_PER_TX], + l2_to_l1_msgs: [Field; MAX_L2_TO_L1_MSGS_PER_TX], note_encrypted_logs_hashes: [LogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], encrypted_logs_hashes: [LogHash; MAX_ENCRYPTED_LOGS_PER_TX], @@ -30,9 +30,9 @@ struct PublicAccumulatedData { impl Empty for PublicAccumulatedData { fn empty() -> Self { PublicAccumulatedData { - new_note_hashes: [NoteHash::empty(); MAX_NEW_NOTE_HASHES_PER_TX], - new_nullifiers: [Nullifier::empty(); MAX_NEW_NULLIFIERS_PER_TX], - new_l2_to_l1_msgs: [0; MAX_NEW_L2_TO_L1_MSGS_PER_TX], + note_hashes: [NoteHash::empty(); MAX_NOTE_HASHES_PER_TX], + nullifiers: [Nullifier::empty(); MAX_NULLIFIERS_PER_TX], + l2_to_l1_msgs: [0; MAX_L2_TO_L1_MSGS_PER_TX], note_encrypted_logs_hashes: [LogHash::empty(); MAX_NOTE_ENCRYPTED_LOGS_PER_TX], encrypted_logs_hashes: [LogHash::empty(); MAX_ENCRYPTED_LOGS_PER_TX], unencrypted_logs_hashes: [LogHash::empty(); MAX_UNENCRYPTED_LOGS_PER_TX], @@ -47,15 +47,15 @@ impl Serialize for PublicAccumulatedData { fn serialize(self) -> [Field; PUBLIC_ACCUMULATED_DATA_LENGTH] { let mut fields: BoundedVec = BoundedVec::new(); - for i in 0..MAX_NEW_NOTE_HASHES_PER_TX { - fields.extend_from_array(self.new_note_hashes[i].serialize()); + for i in 0..MAX_NOTE_HASHES_PER_TX { + fields.extend_from_array(self.note_hashes[i].serialize()); } - for i in 0..MAX_NEW_NULLIFIERS_PER_TX { - fields.extend_from_array(self.new_nullifiers[i].serialize()); + for i in 0..MAX_NULLIFIERS_PER_TX { + fields.extend_from_array(self.nullifiers[i].serialize()); } - fields.extend_from_array(self.new_l2_to_l1_msgs); + fields.extend_from_array(self.l2_to_l1_msgs); for i in 0..MAX_NOTE_ENCRYPTED_LOGS_PER_TX { fields.extend_from_array(self.note_encrypted_logs_hashes[i].serialize()); @@ -90,9 +90,9 @@ impl Deserialize for PublicAccumulatedData { let mut reader = Reader::new(fields); let item = PublicAccumulatedData { - new_note_hashes: reader.read_struct_array(NoteHash::deserialize, [NoteHash::empty(); MAX_NEW_NOTE_HASHES_PER_TX]), - new_nullifiers: reader.read_struct_array(Nullifier::deserialize, [Nullifier::empty(); MAX_NEW_NULLIFIERS_PER_TX]), - new_l2_to_l1_msgs: reader.read_array([0; MAX_NEW_L2_TO_L1_MSGS_PER_TX]), + note_hashes: reader.read_struct_array(NoteHash::deserialize, [NoteHash::empty(); MAX_NOTE_HASHES_PER_TX]), + nullifiers: reader.read_struct_array(Nullifier::deserialize, [Nullifier::empty(); MAX_NULLIFIERS_PER_TX]), + l2_to_l1_msgs: reader.read_array([0; MAX_L2_TO_L1_MSGS_PER_TX]), note_encrypted_logs_hashes: reader.read_struct_array(LogHash::deserialize, [LogHash::empty(); MAX_NOTE_ENCRYPTED_LOGS_PER_TX]), encrypted_logs_hashes: reader.read_struct_array(LogHash::deserialize, [LogHash::empty(); MAX_ENCRYPTED_LOGS_PER_TX]), unencrypted_logs_hashes: reader.read_struct_array(LogHash::deserialize, [LogHash::empty(); MAX_UNENCRYPTED_LOGS_PER_TX]), @@ -107,9 +107,9 @@ impl Deserialize for PublicAccumulatedData { impl Eq for PublicAccumulatedData { fn eq(self, other: Self) -> bool { - (self.new_note_hashes == other.new_note_hashes) & - (self.new_nullifiers == other.new_nullifiers) & - (self.new_l2_to_l1_msgs == other.new_l2_to_l1_msgs) & + (self.note_hashes == other.note_hashes) & + (self.nullifiers == other.nullifiers) & + (self.l2_to_l1_msgs == other.l2_to_l1_msgs) & (self.note_encrypted_logs_hashes == other.note_encrypted_logs_hashes) & (self.encrypted_logs_hashes == other.encrypted_logs_hashes) & (self.unencrypted_logs_hashes == other.unencrypted_logs_hashes) & diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data_builder.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data_builder.nr index 02146a8e452..7d8237922d4 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data_builder.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data_builder.nr @@ -5,17 +5,17 @@ use crate::{ public_data_update_request::PublicDataUpdateRequest, log_hash::{LogHash, NoteLogHash} }, constants::{ - MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, - MAX_NEW_L2_TO_L1_MSGS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_ENCRYPTED_LOGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, + MAX_L2_TO_L1_MSGS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_ENCRYPTED_LOGS_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX }, traits::Empty }; struct PublicAccumulatedDataBuilder { - new_note_hashes: BoundedVec, - new_nullifiers: BoundedVec, - new_l2_to_l1_msgs: BoundedVec, + note_hashes: BoundedVec, + nullifiers: BoundedVec, + l2_to_l1_msgs: BoundedVec, note_encrypted_logs_hashes: BoundedVec, encrypted_logs_hashes: BoundedVec, @@ -31,9 +31,9 @@ struct PublicAccumulatedDataBuilder { impl PublicAccumulatedDataBuilder { pub fn finish(self) -> PublicAccumulatedData { PublicAccumulatedData { - new_note_hashes: self.new_note_hashes.storage, - new_nullifiers: self.new_nullifiers.storage, - new_l2_to_l1_msgs: self.new_l2_to_l1_msgs.storage, + note_hashes: self.note_hashes.storage, + nullifiers: self.nullifiers.storage, + l2_to_l1_msgs: self.l2_to_l1_msgs.storage, note_encrypted_logs_hashes: self.note_encrypted_logs_hashes.storage, encrypted_logs_hashes: self.encrypted_logs_hashes.storage, unencrypted_logs_hashes: self.unencrypted_logs_hashes.storage, @@ -47,9 +47,9 @@ impl PublicAccumulatedDataBuilder { impl Empty for PublicAccumulatedDataBuilder { fn empty() -> Self { PublicAccumulatedDataBuilder { - new_note_hashes: BoundedVec::new(), - new_nullifiers: BoundedVec::new(), - new_l2_to_l1_msgs: BoundedVec::new(), + note_hashes: BoundedVec::new(), + nullifiers: BoundedVec::new(), + l2_to_l1_msgs: BoundedVec::new(), note_encrypted_logs_hashes: BoundedVec::new(), encrypted_logs_hashes: BoundedVec::new(), unencrypted_logs_hashes: BoundedVec::new(), diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_circuit_public_inputs.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_circuit_public_inputs.nr index be8ad0c72dd..8d8ffb85007 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_circuit_public_inputs.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_circuit_public_inputs.nr @@ -11,9 +11,9 @@ struct PrivateKernelCircuitPublicInputsArrayLengths { note_hash_read_requests: u32, nullifier_read_requests: u32, scoped_key_validation_requests_and_generators: u32, - new_note_hashes: u32, - new_nullifiers: u32, - new_l2_to_l1_msgs: u32, + note_hashes: u32, + nullifiers: u32, + l2_to_l1_msgs: u32, note_encrypted_logs_hashes: u32, encrypted_logs_hashes: u32, unencrypted_logs_hashes: u32, @@ -27,9 +27,9 @@ impl PrivateKernelCircuitPublicInputsArrayLengths { note_hash_read_requests: array_length(public_inputs.validation_requests.note_hash_read_requests), nullifier_read_requests: array_length(public_inputs.validation_requests.nullifier_read_requests), scoped_key_validation_requests_and_generators: array_length(public_inputs.validation_requests.scoped_key_validation_requests_and_generators), - new_note_hashes: array_length(public_inputs.end.new_note_hashes), - new_nullifiers: array_length(public_inputs.end.new_nullifiers), - new_l2_to_l1_msgs: array_length(public_inputs.end.new_l2_to_l1_msgs), + note_hashes: array_length(public_inputs.end.note_hashes), + nullifiers: array_length(public_inputs.end.nullifiers), + l2_to_l1_msgs: array_length(public_inputs.end.l2_to_l1_msgs), note_encrypted_logs_hashes: array_length(public_inputs.end.note_encrypted_logs_hashes), encrypted_logs_hashes: array_length(public_inputs.end.encrypted_logs_hashes), unencrypted_logs_hashes: array_length(public_inputs.end.unencrypted_logs_hashes), @@ -43,9 +43,9 @@ impl PrivateKernelCircuitPublicInputsArrayLengths { note_hash_read_requests: 0, nullifier_read_requests: 0, scoped_key_validation_requests_and_generators: 0, - new_note_hashes: 0, - new_nullifiers: 0, - new_l2_to_l1_msgs: 0, + note_hashes: 0, + nullifiers: 0, + l2_to_l1_msgs: 0, note_encrypted_logs_hashes: 0, encrypted_logs_hashes: 0, unencrypted_logs_hashes: 0, @@ -60,9 +60,9 @@ impl Eq for PrivateKernelCircuitPublicInputsArrayLengths { (self.note_hash_read_requests == other.note_hash_read_requests) & (self.nullifier_read_requests == other.nullifier_read_requests) & (self.scoped_key_validation_requests_and_generators == other.scoped_key_validation_requests_and_generators) & - (self.new_note_hashes == other.new_note_hashes) & - (self.new_nullifiers == other.new_nullifiers) & - (self.new_l2_to_l1_msgs == other.new_l2_to_l1_msgs) & + (self.note_hashes == other.note_hashes) & + (self.nullifiers == other.nullifiers) & + (self.l2_to_l1_msgs == other.l2_to_l1_msgs) & (self.note_encrypted_logs_hashes == other.note_encrypted_logs_hashes) & (self.encrypted_logs_hashes == other.encrypted_logs_hashes) & (self.unencrypted_logs_hashes == other.unencrypted_logs_hashes) & diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/private_circuit_public_inputs.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/private_circuit_public_inputs.nr index e0b364dee9d..7848088a944 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/private_circuit_public_inputs.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/private_circuit_public_inputs.nr @@ -7,9 +7,9 @@ use crate::{ }, constants::{ MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, - MAX_KEY_VALIDATION_REQUESTS_PER_CALL, MAX_NEW_NOTE_HASHES_PER_CALL, MAX_NEW_NULLIFIERS_PER_CALL, + MAX_KEY_VALIDATION_REQUESTS_PER_CALL, MAX_NOTE_HASHES_PER_CALL, MAX_NULLIFIERS_PER_CALL, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, - MAX_NEW_L2_TO_L1_MSGS_PER_CALL, PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH, + MAX_L2_TO_L1_MSGS_PER_CALL, PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH, GENERATOR_INDEX__PRIVATE_CIRCUIT_PUBLIC_INPUTS, MAX_ENCRYPTED_LOGS_PER_CALL, MAX_UNENCRYPTED_LOGS_PER_CALL, MAX_NOTE_ENCRYPTED_LOGS_PER_CALL }, @@ -22,9 +22,9 @@ struct PrivateCircuitPublicInputsArrayLengths { note_hash_read_requests: u32, nullifier_read_requests: u32, key_validation_requests_and_generators: u32, - new_note_hashes: u32, - new_nullifiers: u32, - new_l2_to_l1_msgs: u32, + note_hashes: u32, + nullifiers: u32, + l2_to_l1_msgs: u32, private_call_requests: u32, public_call_stack_hashes: u32, note_encrypted_logs_hashes: u32, @@ -38,9 +38,9 @@ impl PrivateCircuitPublicInputsArrayLengths { note_hash_read_requests: validate_array(public_inputs.note_hash_read_requests), nullifier_read_requests: validate_array(public_inputs.nullifier_read_requests), key_validation_requests_and_generators: validate_array(public_inputs.key_validation_requests_and_generators), - new_note_hashes: validate_array(public_inputs.new_note_hashes), - new_nullifiers: validate_array(public_inputs.new_nullifiers), - new_l2_to_l1_msgs: validate_array(public_inputs.new_l2_to_l1_msgs), + note_hashes: validate_array(public_inputs.note_hashes), + nullifiers: validate_array(public_inputs.nullifiers), + l2_to_l1_msgs: validate_array(public_inputs.l2_to_l1_msgs), private_call_requests: validate_array(public_inputs.private_call_requests), public_call_stack_hashes: validate_array(public_inputs.public_call_stack_hashes), note_encrypted_logs_hashes: validate_array(public_inputs.note_encrypted_logs_hashes), @@ -65,12 +65,12 @@ struct PrivateCircuitPublicInputs { nullifier_read_requests: [ReadRequest; MAX_NULLIFIER_READ_REQUESTS_PER_CALL], key_validation_requests_and_generators: [KeyValidationRequestAndGenerator; MAX_KEY_VALIDATION_REQUESTS_PER_CALL], - new_note_hashes: [NoteHash; MAX_NEW_NOTE_HASHES_PER_CALL], - new_nullifiers: [Nullifier; MAX_NEW_NULLIFIERS_PER_CALL], + note_hashes: [NoteHash; MAX_NOTE_HASHES_PER_CALL], + nullifiers: [Nullifier; MAX_NULLIFIERS_PER_CALL], private_call_requests: [PrivateCallRequest; MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL], public_call_stack_hashes: [Field; MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL], public_teardown_function_hash: Field, - new_l2_to_l1_msgs: [L2ToL1Message; MAX_NEW_L2_TO_L1_MSGS_PER_CALL], + l2_to_l1_msgs: [L2ToL1Message; MAX_L2_TO_L1_MSGS_PER_CALL], start_side_effect_counter : u32, end_side_effect_counter : u32, @@ -98,11 +98,11 @@ impl Eq for PrivateCircuitPublicInputs { (self.note_hash_read_requests == other.note_hash_read_requests) & (self.nullifier_read_requests == other.nullifier_read_requests) & (self.key_validation_requests_and_generators == other.key_validation_requests_and_generators) & - (self.new_note_hashes == other.new_note_hashes) & - (self.new_nullifiers == other.new_nullifiers) & + (self.note_hashes == other.note_hashes) & + (self.nullifiers == other.nullifiers) & (self.private_call_requests == other.private_call_requests) & (self.public_call_stack_hashes == other.public_call_stack_hashes) & - (self.new_l2_to_l1_msgs == other.new_l2_to_l1_msgs) & + (self.l2_to_l1_msgs == other.l2_to_l1_msgs) & (self.start_side_effect_counter == other.start_side_effect_counter) & (self.end_side_effect_counter == other.end_side_effect_counter) & (self.note_encrypted_logs_hashes == other.note_encrypted_logs_hashes) & @@ -134,19 +134,19 @@ impl Serialize for PrivateCircuitPublicInp for i in 0..self.key_validation_requests_and_generators.len() { fields.extend_from_array(self.key_validation_requests_and_generators[i].serialize()); } - for i in 0..self.new_note_hashes.len() { - fields.extend_from_array(self.new_note_hashes[i].serialize()); + for i in 0..self.note_hashes.len() { + fields.extend_from_array(self.note_hashes[i].serialize()); } - for i in 0..self.new_nullifiers.len() { - fields.extend_from_array(self.new_nullifiers[i].serialize()); + for i in 0..self.nullifiers.len() { + fields.extend_from_array(self.nullifiers[i].serialize()); } for i in 0..self.private_call_requests.len() { fields.extend_from_array(self.private_call_requests[i].serialize()); } fields.extend_from_array(self.public_call_stack_hashes); fields.push(self.public_teardown_function_hash); - for i in 0..self.new_l2_to_l1_msgs.len() { - fields.extend_from_array(self.new_l2_to_l1_msgs[i].serialize()); + for i in 0..self.l2_to_l1_msgs.len() { + fields.extend_from_array(self.l2_to_l1_msgs[i].serialize()); } fields.push(self.start_side_effect_counter as Field); fields.push(self.end_side_effect_counter as Field); @@ -182,12 +182,12 @@ impl Deserialize for PrivateCircuitPublicI note_hash_read_requests: reader.read_struct_array(ReadRequest::deserialize, [ReadRequest::empty(); MAX_NOTE_HASH_READ_REQUESTS_PER_CALL]), nullifier_read_requests: reader.read_struct_array(ReadRequest::deserialize, [ReadRequest::empty(); MAX_NULLIFIER_READ_REQUESTS_PER_CALL]), key_validation_requests_and_generators: reader.read_struct_array(KeyValidationRequestAndGenerator::deserialize, [KeyValidationRequestAndGenerator::empty(); MAX_KEY_VALIDATION_REQUESTS_PER_CALL]), - new_note_hashes: reader.read_struct_array(NoteHash::deserialize, [NoteHash::empty(); MAX_NEW_NOTE_HASHES_PER_CALL]), - new_nullifiers: reader.read_struct_array(Nullifier::deserialize, [Nullifier::empty(); MAX_NEW_NULLIFIERS_PER_CALL]), + note_hashes: reader.read_struct_array(NoteHash::deserialize, [NoteHash::empty(); MAX_NOTE_HASHES_PER_CALL]), + nullifiers: reader.read_struct_array(Nullifier::deserialize, [Nullifier::empty(); MAX_NULLIFIERS_PER_CALL]), private_call_requests: reader.read_struct_array(PrivateCallRequest::deserialize, [PrivateCallRequest::empty(); MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL]), public_call_stack_hashes: reader.read_array([0; MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL]), public_teardown_function_hash: reader.read(), - new_l2_to_l1_msgs: reader.read_struct_array(L2ToL1Message::deserialize, [L2ToL1Message::empty(); MAX_NEW_L2_TO_L1_MSGS_PER_CALL]), + l2_to_l1_msgs: reader.read_struct_array(L2ToL1Message::deserialize, [L2ToL1Message::empty(); MAX_L2_TO_L1_MSGS_PER_CALL]), start_side_effect_counter: reader.read() as u32, end_side_effect_counter: reader.read() as u32, note_encrypted_logs_hashes: reader.read_struct_array(NoteLogHash::deserialize, [NoteLogHash::empty(); MAX_NOTE_ENCRYPTED_LOGS_PER_CALL]), @@ -220,12 +220,12 @@ impl Empty for PrivateCircuitPublicInputs { note_hash_read_requests: [ReadRequest::empty(); MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], nullifier_read_requests: [ReadRequest::empty(); MAX_NULLIFIER_READ_REQUESTS_PER_CALL], key_validation_requests_and_generators: [KeyValidationRequestAndGenerator::empty(); MAX_KEY_VALIDATION_REQUESTS_PER_CALL], - new_note_hashes: [NoteHash::empty(); MAX_NEW_NOTE_HASHES_PER_CALL], - new_nullifiers: [Nullifier::empty(); MAX_NEW_NULLIFIERS_PER_CALL], + note_hashes: [NoteHash::empty(); MAX_NOTE_HASHES_PER_CALL], + nullifiers: [Nullifier::empty(); MAX_NULLIFIERS_PER_CALL], private_call_requests: [PrivateCallRequest::empty(); MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL], public_call_stack_hashes: [0; MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL], public_teardown_function_hash: 0, - new_l2_to_l1_msgs: [L2ToL1Message::empty(); MAX_NEW_L2_TO_L1_MSGS_PER_CALL], + l2_to_l1_msgs: [L2ToL1Message::empty(); MAX_L2_TO_L1_MSGS_PER_CALL], start_side_effect_counter : 0 as u32, end_side_effect_counter : 0 as u32, note_encrypted_logs_hashes: [NoteLogHash::empty(); MAX_NOTE_ENCRYPTED_LOGS_PER_CALL], diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/public_call_stack_item.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/public_call_stack_item.nr index 891985268ef..4c12a77d0d3 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/public_call_stack_item.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/public_call_stack_item.nr @@ -62,7 +62,7 @@ mod tests { let function_data = FunctionData { selector: FunctionSelector::from_u32(2), is_private: false }; let mut public_inputs = PublicCircuitPublicInputs::empty(); - public_inputs.new_note_hashes[0] = NoteHash { + public_inputs.note_hashes[0] = NoteHash { value: 1, counter: 0, }; @@ -80,7 +80,7 @@ mod tests { let function_data = FunctionData { selector: FunctionSelector::from_u32(2), is_private: false }; let mut public_inputs = PublicCircuitPublicInputs::empty(); - public_inputs.new_note_hashes[0] = NoteHash { + public_inputs.note_hashes[0] = NoteHash { value: 1, counter: 0, }; diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/public_circuit_public_inputs.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/public_circuit_public_inputs.nr index 34da6c7df02..555ab222440 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/public_circuit_public_inputs.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/public_circuit_public_inputs.nr @@ -5,8 +5,8 @@ use crate::{ }, address::AztecAddress, constants::{ - MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL, MAX_NEW_L2_TO_L1_MSGS_PER_CALL, - MAX_NEW_NULLIFIERS_PER_CALL, MAX_NEW_NOTE_HASHES_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, + MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL, MAX_L2_TO_L1_MSGS_PER_CALL, MAX_NULLIFIERS_PER_CALL, + MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_DATA_READS_PER_CALL, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL, GENERATOR_INDEX__PUBLIC_CIRCUIT_PUBLIC_INPUTS, @@ -32,9 +32,9 @@ struct PublicCircuitPublicInputs { // todo: add sideeffect ranges for the input to these hashes public_call_stack_hashes: [Field; MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL], - new_note_hashes: [NoteHash; MAX_NEW_NOTE_HASHES_PER_CALL], - new_nullifiers: [Nullifier; MAX_NEW_NULLIFIERS_PER_CALL], - new_l2_to_l1_msgs: [L2ToL1Message; MAX_NEW_L2_TO_L1_MSGS_PER_CALL], + note_hashes: [NoteHash; MAX_NOTE_HASHES_PER_CALL], + nullifiers: [Nullifier; MAX_NULLIFIERS_PER_CALL], + l2_to_l1_msgs: [L2ToL1Message; MAX_L2_TO_L1_MSGS_PER_CALL], start_side_effect_counter: u32, end_side_effect_counter: u32, @@ -89,14 +89,14 @@ impl Serialize for PublicCircuitPublicInput } fields.extend_from_array(self.public_call_stack_hashes); - for i in 0..MAX_NEW_NOTE_HASHES_PER_CALL { - fields.extend_from_array(self.new_note_hashes[i].serialize()); + for i in 0..MAX_NOTE_HASHES_PER_CALL { + fields.extend_from_array(self.note_hashes[i].serialize()); } - for i in 0..MAX_NEW_NULLIFIERS_PER_CALL { - fields.extend_from_array(self.new_nullifiers[i].serialize()); + for i in 0..MAX_NULLIFIERS_PER_CALL { + fields.extend_from_array(self.nullifiers[i].serialize()); } - for i in 0..MAX_NEW_L2_TO_L1_MSGS_PER_CALL { - fields.extend_from_array(self.new_l2_to_l1_msgs[i].serialize()); + for i in 0..MAX_L2_TO_L1_MSGS_PER_CALL { + fields.extend_from_array(self.l2_to_l1_msgs[i].serialize()); } fields.push(self.start_side_effect_counter as Field); @@ -131,9 +131,9 @@ impl Deserialize for PublicCircuitPublicInp contract_storage_update_requests: reader.read_struct_array(StorageUpdateRequest::deserialize, [StorageUpdateRequest::empty(); MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL]), contract_storage_reads: reader.read_struct_array(StorageRead::deserialize, [StorageRead::empty(); MAX_PUBLIC_DATA_READS_PER_CALL]), public_call_stack_hashes: reader.read_array([0; MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL]), - new_note_hashes: reader.read_struct_array(NoteHash::deserialize, [NoteHash::empty(); MAX_NEW_NOTE_HASHES_PER_CALL]), - new_nullifiers: reader.read_struct_array(Nullifier::deserialize, [Nullifier::empty(); MAX_NEW_NULLIFIERS_PER_CALL]), - new_l2_to_l1_msgs: reader.read_struct_array(L2ToL1Message::deserialize, [L2ToL1Message::empty(); MAX_NEW_L2_TO_L1_MSGS_PER_CALL]), + note_hashes: reader.read_struct_array(NoteHash::deserialize, [NoteHash::empty(); MAX_NOTE_HASHES_PER_CALL]), + nullifiers: reader.read_struct_array(Nullifier::deserialize, [Nullifier::empty(); MAX_NULLIFIERS_PER_CALL]), + l2_to_l1_msgs: reader.read_struct_array(L2ToL1Message::deserialize, [L2ToL1Message::empty(); MAX_L2_TO_L1_MSGS_PER_CALL]), start_side_effect_counter: reader.read() as u32, end_side_effect_counter: reader.read() as u32, unencrypted_logs_hashes: reader.read_struct_array(LogHash::deserialize, [LogHash::empty(); MAX_UNENCRYPTED_LOGS_PER_CALL]), @@ -170,9 +170,9 @@ impl Empty for PublicCircuitPublicInputs { contract_storage_update_requests: [StorageUpdateRequest::empty(); MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL], contract_storage_reads: [StorageRead::empty(); MAX_PUBLIC_DATA_READS_PER_CALL], public_call_stack_hashes: [0; MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL], - new_note_hashes: [NoteHash::empty(); MAX_NEW_NOTE_HASHES_PER_CALL], - new_nullifiers: [Nullifier::empty(); MAX_NEW_NULLIFIERS_PER_CALL], - new_l2_to_l1_msgs: [L2ToL1Message::empty(); MAX_NEW_L2_TO_L1_MSGS_PER_CALL], + note_hashes: [NoteHash::empty(); MAX_NOTE_HASHES_PER_CALL], + nullifiers: [Nullifier::empty(); MAX_NULLIFIERS_PER_CALL], + l2_to_l1_msgs: [L2ToL1Message::empty(); MAX_L2_TO_L1_MSGS_PER_CALL], start_side_effect_counter: 0 as u32, end_side_effect_counter: 0 as u32, unencrypted_logs_hashes: [LogHash::empty(); MAX_UNENCRYPTED_LOGS_PER_CALL], 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 14855e03d45..b830d210c51 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -7,26 +7,26 @@ global ARGS_LENGTH: u32 = 16; * * Agreed convention is to use MAX_XXX_PER_CALL resp. MAX_XXX_PER_TX, where XXX denotes a type of element such as * commitment, or nullifier, e.g.,: - * - MAX_NEW_NULLIFIERS_PER_CALL - * - MAX_NEW_NOTE_HASHES_PER_TX + * - MAX_NULLIFIERS_PER_CALL + * - MAX_NOTE_HASHES_PER_TX * * In the kernel circuits, we accumulate elements such as note hashes and the nullifiers from all functions calls in a * transaction. Therefore, we always must have: * MAX_XXX_PER_TX ≥ MAX_XXX_PER_CALL * * For instance: - * MAX_NEW_NOTE_HASHES_PER_TX ≥ MAX_NEW_NOTE_HASHES_PER_CALL - * MAX_NEW_NULLIFIERS_PER_TX ≥ MAX_NEW_NULLIFIERS_PER_CALL + * MAX_NOTE_HASHES_PER_TX ≥ MAX_NOTE_HASHES_PER_CALL + * MAX_NULLIFIERS_PER_TX ≥ MAX_NULLIFIERS_PER_CALL * */ // docs:start:constants // "PER CALL" CONSTANTS -global MAX_NEW_NOTE_HASHES_PER_CALL: u32 = 16; -global MAX_NEW_NULLIFIERS_PER_CALL: u32 = 16; +global MAX_NOTE_HASHES_PER_CALL: u32 = 16; +global MAX_NULLIFIERS_PER_CALL: u32 = 16; global MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL: u32 = 4; global MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL: u32 = 16; -global MAX_NEW_L2_TO_L1_MSGS_PER_CALL: u32 = 2; +global MAX_L2_TO_L1_MSGS_PER_CALL: u32 = 2; global MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL: u32 = 32; global MAX_PUBLIC_DATA_READS_PER_CALL: u32 = 32; global MAX_NOTE_HASH_READ_REQUESTS_PER_CALL: u32 = 16; @@ -39,8 +39,8 @@ global MAX_ENCRYPTED_LOGS_PER_CALL: u32 = 4; // If modifying, update DEPLOYER_CO global MAX_UNENCRYPTED_LOGS_PER_CALL: u32 = 4; // If modifying, update DEPLOYER_CONTRACT_ADDRESS. // "PER TRANSACTION" CONSTANTS -global MAX_NEW_NOTE_HASHES_PER_TX: u32 = 64; -global MAX_NEW_NULLIFIERS_PER_TX: u32 = 64; +global MAX_NOTE_HASHES_PER_TX: u32 = 64; +global MAX_NULLIFIERS_PER_TX: u32 = 64; global MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX: u32 = 8; global MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX: u32 = 32; // If you touch any of the constants below don't forget to update MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX. @@ -51,7 +51,7 @@ global PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX: u32 = 1; // Pain. global MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX: u32 = 64; // MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX + PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX; global MAX_PUBLIC_DATA_READS_PER_TX: u32 = 64; -global MAX_NEW_L2_TO_L1_MSGS_PER_TX: u32 = 8; +global MAX_L2_TO_L1_MSGS_PER_TX: u32 = 8; global MAX_NOTE_HASH_READ_REQUESTS_PER_TX: u32 = 64; global MAX_NULLIFIER_READ_REQUESTS_PER_TX: u32 = 64; global MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX: u32 = 64; @@ -193,8 +193,8 @@ global TX_CONTEXT_LENGTH: u32 = 2 + GAS_SETTINGS_LENGTH; global TX_REQUEST_LENGTH: u32 = 2 + TX_CONTEXT_LENGTH + FUNCTION_DATA_LENGTH; global TOTAL_FEES_LENGTH = 1; global HEADER_LENGTH: u32 = APPEND_ONLY_TREE_SNAPSHOT_LENGTH + CONTENT_COMMITMENT_LENGTH + STATE_REFERENCE_LENGTH + GLOBAL_VARIABLES_LENGTH + TOTAL_FEES_LENGTH; -global PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH: u32 = CALL_CONTEXT_LENGTH + 4 + MAX_BLOCK_NUMBER_LENGTH + (READ_REQUEST_LENGTH * MAX_NOTE_HASH_READ_REQUESTS_PER_CALL) + (READ_REQUEST_LENGTH * MAX_NULLIFIER_READ_REQUESTS_PER_CALL) + (KEY_VALIDATION_REQUEST_AND_GENERATOR_LENGTH * MAX_KEY_VALIDATION_REQUESTS_PER_CALL) + (NOTE_HASH_LENGTH * MAX_NEW_NOTE_HASHES_PER_CALL) + (NULLIFIER_LENGTH * MAX_NEW_NULLIFIERS_PER_CALL) + (PRIVATE_CALL_REQUEST_LENGTH * MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL) + MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL + 1 + (L2_TO_L1_MESSAGE_LENGTH * MAX_NEW_L2_TO_L1_MSGS_PER_CALL) + 2 + (NOTE_LOG_HASH_LENGTH * MAX_NOTE_ENCRYPTED_LOGS_PER_CALL) + (ENCRYPTED_LOG_HASH_LENGTH * MAX_ENCRYPTED_LOGS_PER_CALL) + (LOG_HASH_LENGTH * MAX_UNENCRYPTED_LOGS_PER_CALL) + HEADER_LENGTH + TX_CONTEXT_LENGTH; -global PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH: u32 = CALL_CONTEXT_LENGTH + /*argsHash + returnsHash*/ 2 + (READ_REQUEST_LENGTH * MAX_NOTE_HASH_READ_REQUESTS_PER_CALL) + (READ_REQUEST_LENGTH * MAX_NULLIFIER_READ_REQUESTS_PER_CALL) + (READ_REQUEST_LENGTH * MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL) + (READ_REQUEST_LENGTH * MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL) + (CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH * MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL) + (CONTRACT_STORAGE_READ_LENGTH * MAX_PUBLIC_DATA_READS_PER_CALL) + MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL + (NOTE_HASH_LENGTH * MAX_NEW_NOTE_HASHES_PER_CALL) + (NULLIFIER_LENGTH * MAX_NEW_NULLIFIERS_PER_CALL) + (L2_TO_L1_MESSAGE_LENGTH * MAX_NEW_L2_TO_L1_MSGS_PER_CALL) + 2 + (LOG_HASH_LENGTH * MAX_UNENCRYPTED_LOGS_PER_CALL) + HEADER_LENGTH + GLOBAL_VARIABLES_LENGTH + AZTEC_ADDRESS_LENGTH + /* revert_code */ 1 + 2 * GAS_LENGTH + /* transaction_fee */ 1; +global PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH: u32 = CALL_CONTEXT_LENGTH + 4 + MAX_BLOCK_NUMBER_LENGTH + (READ_REQUEST_LENGTH * MAX_NOTE_HASH_READ_REQUESTS_PER_CALL) + (READ_REQUEST_LENGTH * MAX_NULLIFIER_READ_REQUESTS_PER_CALL) + (KEY_VALIDATION_REQUEST_AND_GENERATOR_LENGTH * MAX_KEY_VALIDATION_REQUESTS_PER_CALL) + (NOTE_HASH_LENGTH * MAX_NOTE_HASHES_PER_CALL) + (NULLIFIER_LENGTH * MAX_NULLIFIERS_PER_CALL) + (PRIVATE_CALL_REQUEST_LENGTH * MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL) + MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL + 1 + (L2_TO_L1_MESSAGE_LENGTH * MAX_L2_TO_L1_MSGS_PER_CALL) + 2 + (NOTE_LOG_HASH_LENGTH * MAX_NOTE_ENCRYPTED_LOGS_PER_CALL) + (ENCRYPTED_LOG_HASH_LENGTH * MAX_ENCRYPTED_LOGS_PER_CALL) + (LOG_HASH_LENGTH * MAX_UNENCRYPTED_LOGS_PER_CALL) + HEADER_LENGTH + TX_CONTEXT_LENGTH; +global PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH: u32 = CALL_CONTEXT_LENGTH + /*argsHash + returnsHash*/ 2 + (READ_REQUEST_LENGTH * MAX_NOTE_HASH_READ_REQUESTS_PER_CALL) + (READ_REQUEST_LENGTH * MAX_NULLIFIER_READ_REQUESTS_PER_CALL) + (READ_REQUEST_LENGTH * MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL) + (READ_REQUEST_LENGTH * MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL) + (CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH * MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL) + (CONTRACT_STORAGE_READ_LENGTH * MAX_PUBLIC_DATA_READS_PER_CALL) + MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL + (NOTE_HASH_LENGTH * MAX_NOTE_HASHES_PER_CALL) + (NULLIFIER_LENGTH * MAX_NULLIFIERS_PER_CALL) + (L2_TO_L1_MESSAGE_LENGTH * MAX_L2_TO_L1_MSGS_PER_CALL) + 2 + (LOG_HASH_LENGTH * MAX_UNENCRYPTED_LOGS_PER_CALL) + HEADER_LENGTH + GLOBAL_VARIABLES_LENGTH + AZTEC_ADDRESS_LENGTH + /* revert_code */ 1 + 2 * GAS_LENGTH + /* transaction_fee */ 1; global PRIVATE_CALL_STACK_ITEM_LENGTH: u32 = AZTEC_ADDRESS_LENGTH + FUNCTION_DATA_LENGTH + PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH; global PUBLIC_CONTEXT_INPUTS_LENGTH: u32 = CALL_CONTEXT_LENGTH + HEADER_LENGTH + GLOBAL_VARIABLES_LENGTH + GAS_LENGTH + 2; @@ -205,14 +205,14 @@ global PUBLIC_DATA_READ_LENGTH = 2; global VALIDATION_REQUESTS_LENGTH = ROLLUP_VALIDATION_REQUESTS_LENGTH + (SCOPED_READ_REQUEST_LEN * MAX_NOTE_HASH_READ_REQUESTS_PER_TX) + (SCOPED_READ_REQUEST_LEN * MAX_NULLIFIER_READ_REQUESTS_PER_TX) + (SCOPED_READ_REQUEST_LEN * MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX) + (SCOPED_KEY_VALIDATION_REQUEST_AND_GENERATOR_LENGTH * MAX_KEY_VALIDATION_REQUESTS_PER_TX) + (PUBLIC_DATA_READ_LENGTH * MAX_PUBLIC_DATA_READS_PER_TX); global PUBLIC_DATA_UPDATE_REQUEST_LENGTH = 3; -global COMBINED_ACCUMULATED_DATA_LENGTH = MAX_NEW_NOTE_HASHES_PER_TX + MAX_NEW_NULLIFIERS_PER_TX + MAX_NEW_L2_TO_L1_MSGS_PER_TX + 6 + (MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * PUBLIC_DATA_UPDATE_REQUEST_LENGTH) + GAS_LENGTH; +global COMBINED_ACCUMULATED_DATA_LENGTH = MAX_NOTE_HASHES_PER_TX + MAX_NULLIFIERS_PER_TX + MAX_L2_TO_L1_MSGS_PER_TX + 6 + (MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * PUBLIC_DATA_UPDATE_REQUEST_LENGTH) + GAS_LENGTH; global COMBINED_CONSTANT_DATA_LENGTH = HEADER_LENGTH + TX_CONTEXT_LENGTH + GLOBAL_VARIABLES_LENGTH; global CALL_REQUEST_LENGTH = 1 + AZTEC_ADDRESS_LENGTH + CALLER_CONTEXT_LENGTH + 2; -global PRIVATE_ACCUMULATED_DATA_LENGTH = (SCOPED_NOTE_HASH_LENGTH * MAX_NEW_NOTE_HASHES_PER_TX) + (SCOPED_NULLIFIER_LENGTH * MAX_NEW_NULLIFIERS_PER_TX) + (MAX_NEW_L2_TO_L1_MSGS_PER_TX * SCOPED_L2_TO_L1_MESSAGE_LENGTH) + (NOTE_LOG_HASH_LENGTH * MAX_NOTE_ENCRYPTED_LOGS_PER_TX) + (SCOPED_ENCRYPTED_LOG_HASH_LENGTH * MAX_ENCRYPTED_LOGS_PER_TX) + (SCOPED_LOG_HASH_LENGTH * MAX_UNENCRYPTED_LOGS_PER_TX) + (SCOPED_PRIVATE_CALL_REQUEST_LENGTH * MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX) + (CALL_REQUEST_LENGTH * MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX); +global PRIVATE_ACCUMULATED_DATA_LENGTH = (SCOPED_NOTE_HASH_LENGTH * MAX_NOTE_HASHES_PER_TX) + (SCOPED_NULLIFIER_LENGTH * MAX_NULLIFIERS_PER_TX) + (MAX_L2_TO_L1_MSGS_PER_TX * SCOPED_L2_TO_L1_MESSAGE_LENGTH) + (NOTE_LOG_HASH_LENGTH * MAX_NOTE_ENCRYPTED_LOGS_PER_TX) + (SCOPED_ENCRYPTED_LOG_HASH_LENGTH * MAX_ENCRYPTED_LOGS_PER_TX) + (SCOPED_LOG_HASH_LENGTH * MAX_UNENCRYPTED_LOGS_PER_TX) + (SCOPED_PRIVATE_CALL_REQUEST_LENGTH * MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX) + (CALL_REQUEST_LENGTH * MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX); global PRIVATE_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 1 + VALIDATION_REQUESTS_LENGTH + PRIVATE_ACCUMULATED_DATA_LENGTH + COMBINED_CONSTANT_DATA_LENGTH + CALL_REQUEST_LENGTH + AZTEC_ADDRESS_LENGTH; -global PUBLIC_ACCUMULATED_DATA_LENGTH = (MAX_NEW_NOTE_HASHES_PER_TX * NOTE_HASH_LENGTH) + (MAX_NEW_NULLIFIERS_PER_TX * NULLIFIER_LENGTH) + (MAX_NEW_L2_TO_L1_MSGS_PER_TX * 1) + (MAX_NOTE_ENCRYPTED_LOGS_PER_TX * LOG_HASH_LENGTH) + (MAX_ENCRYPTED_LOGS_PER_TX * LOG_HASH_LENGTH) + (MAX_UNENCRYPTED_LOGS_PER_TX * LOG_HASH_LENGTH) + (MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * PUBLIC_DATA_UPDATE_REQUEST_LENGTH) + (MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX * CALL_REQUEST_LENGTH) + GAS_LENGTH; +global PUBLIC_ACCUMULATED_DATA_LENGTH = (MAX_NOTE_HASHES_PER_TX * NOTE_HASH_LENGTH) + (MAX_NULLIFIERS_PER_TX * NULLIFIER_LENGTH) + (MAX_L2_TO_L1_MSGS_PER_TX * 1) + (MAX_NOTE_ENCRYPTED_LOGS_PER_TX * LOG_HASH_LENGTH) + (MAX_ENCRYPTED_LOGS_PER_TX * LOG_HASH_LENGTH) + (MAX_UNENCRYPTED_LOGS_PER_TX * LOG_HASH_LENGTH) + (MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * PUBLIC_DATA_UPDATE_REQUEST_LENGTH) + (MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX * CALL_REQUEST_LENGTH) + GAS_LENGTH; global PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = VALIDATION_REQUESTS_LENGTH + PUBLIC_ACCUMULATED_DATA_LENGTH + PUBLIC_ACCUMULATED_DATA_LENGTH + COMBINED_CONSTANT_DATA_LENGTH + 1 + (MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX * CALL_REQUEST_LENGTH) + AZTEC_ADDRESS_LENGTH; global KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = ROLLUP_VALIDATION_REQUESTS_LENGTH + COMBINED_ACCUMULATED_DATA_LENGTH + COMBINED_CONSTANT_DATA_LENGTH + PARTIAL_STATE_REFERENCE_LENGTH + 1 + AZTEC_ADDRESS_LENGTH; @@ -224,8 +224,8 @@ global BASE_OR_MERGE_PUBLIC_INPUTS_LENGTH = CONSTANT_ROLLUP_DATA_LENGTH + PARTIA global ENQUEUE_PUBLIC_FUNCTION_CALL_RETURN_LENGTH: u32 = 3 + CALL_CONTEXT_LENGTH; global GET_NOTES_ORACLE_RETURN_LENGTH: u32 = 674; -global NOTE_HASHES_NUM_BYTES_PER_BASE_ROLLUP: u32 = 32 * MAX_NEW_NOTE_HASHES_PER_TX; -global NULLIFIERS_NUM_BYTES_PER_BASE_ROLLUP: u32 = 32 * MAX_NEW_NULLIFIERS_PER_TX; +global NOTE_HASHES_NUM_BYTES_PER_BASE_ROLLUP: u32 = 32 * MAX_NOTE_HASHES_PER_TX; +global NULLIFIERS_NUM_BYTES_PER_BASE_ROLLUP: u32 = 32 * MAX_NULLIFIERS_PER_TX; global PUBLIC_DATA_WRITES_NUM_BYTES_PER_BASE_ROLLUP: u32 = 64 * MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX; // 1 write is 64 bytes global CONTRACTS_NUM_BYTES_PER_BASE_ROLLUP: Field = 32; global CONTRACT_DATA_NUM_BYTES_PER_BASE_ROLLUP: Field = 64; @@ -339,6 +339,6 @@ global START_L1_TO_L2_MSG_EXISTS_WRITE_OFFSET: u32 = START_NULLIFIER_NON_EXISTS_ global START_SSTORE_WRITE_OFFSET: u32 = START_L1_TO_L2_MSG_EXISTS_WRITE_OFFSET + MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL; global START_SLOAD_WRITE_OFFSET: u32 = START_SSTORE_WRITE_OFFSET + MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL; global START_EMIT_NOTE_HASH_WRITE_OFFSET: u32 = START_SLOAD_WRITE_OFFSET + MAX_PUBLIC_DATA_READS_PER_CALL; -global START_EMIT_NULLIFIER_WRITE_OFFSET: u32 = START_EMIT_NOTE_HASH_WRITE_OFFSET + MAX_NEW_NOTE_HASHES_PER_CALL; -global START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET: u32 = START_EMIT_NULLIFIER_WRITE_OFFSET + MAX_NEW_NULLIFIERS_PER_CALL; -global START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET: u32 = START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET + MAX_NEW_L2_TO_L1_MSGS_PER_CALL; +global START_EMIT_NULLIFIER_WRITE_OFFSET: u32 = START_EMIT_NOTE_HASH_WRITE_OFFSET + MAX_NOTE_HASHES_PER_CALL; +global START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET: u32 = START_EMIT_NULLIFIER_WRITE_OFFSET + MAX_NULLIFIERS_PER_CALL; +global START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET: u32 = START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET + MAX_L2_TO_L1_MSGS_PER_CALL; 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 bf4a9151288..85a039642cf 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 @@ -25,8 +25,8 @@ use crate::{ }, address::{AztecAddress, EthAddress, SaltedInitializationHash, PublicKeysHash}, constants::{ - FUNCTION_TREE_HEIGHT, MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, - MAX_NEW_L2_TO_L1_MSGS_PER_TX, MAX_PUBLIC_DATA_READS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, + FUNCTION_TREE_HEIGHT, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, + MAX_PUBLIC_DATA_READS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX, MAX_KEY_VALIDATION_REQUESTS_PER_TX, VK_TREE_HEIGHT, @@ -82,9 +82,9 @@ struct FixtureBuilder { global_variables: GlobalVariables, // Accumulated data. - new_note_hashes: BoundedVec, - new_nullifiers: BoundedVec, - new_l2_to_l1_msgs: BoundedVec, + note_hashes: BoundedVec, + nullifiers: BoundedVec, + l2_to_l1_msgs: BoundedVec, note_encrypted_logs_hashes: BoundedVec, encrypted_logs_hashes: BoundedVec, unencrypted_logs_hashes: BoundedVec, @@ -246,12 +246,12 @@ impl FixtureBuilder { key_validation_requests_and_generators: subarray( self.scoped_key_validation_requests_and_generators.storage.map(|r: ScopedKeyValidationRequestAndGenerator| r.request) ), - new_note_hashes: subarray(self.new_note_hashes.storage.map(|n: ScopedNoteHash| n.note_hash)), - new_nullifiers: subarray(self.new_nullifiers.storage.map(|n: ScopedNullifier| n.nullifier)), + note_hashes: subarray(self.note_hashes.storage.map(|n: ScopedNoteHash| n.note_hash)), + nullifiers: subarray(self.nullifiers.storage.map(|n: ScopedNullifier| n.nullifier)), private_call_requests: subarray(self.private_call_requests.storage.map(|r: ScopedPrivateCallRequest| r.call_request)), public_call_stack_hashes: subarray(self.public_call_requests.storage.map(|c: CallRequest| c.hash)), public_teardown_function_hash: self.public_teardown_call_stack.storage[0].hash, - new_l2_to_l1_msgs: subarray(self.new_l2_to_l1_msgs.storage.map(|r: ScopedL2ToL1Message| r.message)), + l2_to_l1_msgs: subarray(self.l2_to_l1_msgs.storage.map(|r: ScopedL2ToL1Message| r.message)), start_side_effect_counter: self.counter_start, end_side_effect_counter: self.counter, note_encrypted_logs_hashes: subarray(self.note_encrypted_logs_hashes.storage), @@ -288,9 +288,9 @@ impl FixtureBuilder { pub fn to_private_accumulated_data_builder(self) -> PrivateAccumulatedDataBuilder { PrivateAccumulatedDataBuilder { - new_note_hashes: self.new_note_hashes, - new_nullifiers: self.new_nullifiers, - new_l2_to_l1_msgs: self.new_l2_to_l1_msgs, + note_hashes: self.note_hashes, + nullifiers: self.nullifiers, + l2_to_l1_msgs: self.l2_to_l1_msgs, note_encrypted_logs_hashes: self.note_encrypted_logs_hashes, encrypted_logs_hashes: self.encrypted_logs_hashes, unencrypted_logs_hashes: self.unencrypted_logs_hashes, @@ -304,17 +304,11 @@ impl FixtureBuilder { } pub fn to_public_accumulated_data_builder(self) -> PublicAccumulatedDataBuilder { - let new_note_hashes = BoundedVec { - storage: self.new_note_hashes.storage.map(|n: ScopedNoteHash| n.note_hash), - len: self.new_note_hashes.len() - }; - let new_nullifiers = BoundedVec { - storage: self.new_nullifiers.storage.map(|n: ScopedNullifier| n.nullifier), - len: self.new_nullifiers.len() - }; - let new_l2_to_l1_msgs = BoundedVec { - storage: self.new_l2_to_l1_msgs.storage.map(|m: ScopedL2ToL1Message| m.message.content), - len: self.new_l2_to_l1_msgs.len() + let note_hashes = BoundedVec { storage: self.note_hashes.storage.map(|n: ScopedNoteHash| n.note_hash), len: self.note_hashes.len() }; + let nullifiers = BoundedVec { storage: self.nullifiers.storage.map(|n: ScopedNullifier| n.nullifier), len: self.nullifiers.len() }; + let l2_to_l1_msgs = BoundedVec { + storage: self.l2_to_l1_msgs.storage.map(|m: ScopedL2ToL1Message| m.message.content), + len: self.l2_to_l1_msgs.len() }; let note_encrypted_logs_hashes = BoundedVec { storage: self.note_encrypted_logs_hashes.storage.map(|l: NoteLogHash| LogHash { value: l.value, counter: l.counter, length: l.length }), @@ -330,9 +324,9 @@ impl FixtureBuilder { }; PublicAccumulatedDataBuilder { - new_note_hashes, - new_nullifiers, - new_l2_to_l1_msgs, + note_hashes, + nullifiers, + l2_to_l1_msgs, note_encrypted_logs_hashes, encrypted_logs_hashes, unencrypted_logs_hashes, @@ -348,9 +342,9 @@ impl FixtureBuilder { pub fn to_exposed_public_accumulated_data(self) -> PublicAccumulatedData { PublicAccumulatedData { - new_note_hashes: self.new_note_hashes.storage.map(|n: ScopedNoteHash| n.expose_to_public()), - new_nullifiers: self.new_nullifiers.storage.map(|n: ScopedNullifier| n.expose_to_public()), - new_l2_to_l1_msgs: self.new_l2_to_l1_msgs.storage.map(|m: ScopedL2ToL1Message| m.message.content), + note_hashes: self.note_hashes.storage.map(|n: ScopedNoteHash| n.expose_to_public()), + nullifiers: self.nullifiers.storage.map(|n: ScopedNullifier| n.expose_to_public()), + l2_to_l1_msgs: self.l2_to_l1_msgs.storage.map(|m: ScopedL2ToL1Message| m.message.content), note_encrypted_logs_hashes: self.note_encrypted_logs_hashes.storage.map(|l: NoteLogHash| l.expose_to_public()), encrypted_logs_hashes: self.encrypted_logs_hashes.storage.map(|l: ScopedEncryptedLogHash| l.expose_to_public()), unencrypted_logs_hashes: self.unencrypted_logs_hashes.storage.map(|l: ScopedLogHash| l.expose_to_public()), @@ -364,9 +358,9 @@ impl FixtureBuilder { pub fn to_combined_accumulated_data(self) -> CombinedAccumulatedData { CombinedAccumulatedData { - new_note_hashes: self.new_note_hashes.storage.map(|n: ScopedNoteHash| n.note_hash.value), - new_nullifiers: self.new_nullifiers.storage.map(|n: ScopedNullifier| n.nullifier.value), - new_l2_to_l1_msgs: self.new_l2_to_l1_msgs.storage.map(|m: ScopedL2ToL1Message| m.message.content), + note_hashes: self.note_hashes.storage.map(|n: ScopedNoteHash| n.note_hash.value), + nullifiers: self.nullifiers.storage.map(|n: ScopedNullifier| n.nullifier.value), + l2_to_l1_msgs: self.l2_to_l1_msgs.storage.map(|m: ScopedL2ToL1Message| m.message.content), note_encrypted_logs_hash: self.note_encrypted_logs_hash, encrypted_logs_hash: self.encrypted_logs_hash, unencrypted_logs_hash: self.unencrypted_logs_hash, @@ -476,44 +470,44 @@ impl FixtureBuilder { } pub fn add_new_note_hash(&mut self, value: Field, nullifier_counter: u32) { - self.new_note_hashes.push( + self.note_hashes.push( NoteHash { value, counter: self.next_counter() }.scope(nullifier_counter, self.storage_contract_address) ); } pub fn add_siloed_note_hash(&mut self, value: Field) { // First nullifier is tx hash. - let tx_hash = self.new_nullifiers.get(0).value(); - let index = self.new_note_hashes.len(); + let tx_hash = self.nullifiers.get(0).value(); + let index = self.note_hashes.len(); let note_hash = NoteHash { value, counter: 0 }.scope(0, self.storage_contract_address); let siloed_value = silo_note_hash(note_hash, tx_hash, index); self.add_new_note_hash(siloed_value, 0); } - pub fn append_new_note_hashes(&mut self, num_new_note_hashes: u32) { - let index_offset = self.new_note_hashes.len(); - for i in 0..self.new_note_hashes.max_len() { - if i < num_new_note_hashes { + pub fn append_note_hashes(&mut self, num_note_hashes: u32) { + let index_offset = self.note_hashes.len(); + for i in 0..self.note_hashes.max_len() { + if i < num_note_hashes { let value = self.mock_note_hash_value(index_offset + i); self.add_new_note_hash(value, 0); } } } - pub fn append_siloed_note_hashes(&mut self, num_new_note_hashes: u32) { - let index_offset = self.new_note_hashes.len(); - for i in 0..self.new_note_hashes.max_len() { - if i < num_new_note_hashes { + pub fn append_siloed_note_hashes(&mut self, num_note_hashes: u32) { + let index_offset = self.note_hashes.len(); + for i in 0..self.note_hashes.max_len() { + if i < num_note_hashes { let value = self.mock_note_hash_value(index_offset + i); self.add_siloed_note_hash(value); } } } - pub fn append_new_note_hashes_with_logs(&mut self, num_new_note_hashes: u32) { - let index_offset = self.new_note_hashes.len(); - for i in 0..self.new_note_hashes.max_len() { - if i < num_new_note_hashes { + pub fn append_note_hashes_with_logs(&mut self, num_note_hashes: u32) { + let index_offset = self.note_hashes.len(); + for i in 0..self.note_hashes.max_len() { + if i < num_note_hashes { let value = self.mock_note_hash_value(index_offset + i); self.add_new_note_hash(value, 0); let (log_hash, length) = self.mock_note_encrypted_log(index_offset + i); @@ -523,14 +517,14 @@ impl FixtureBuilder { } pub fn set_first_nullifier(&mut self) { - assert_eq(self.new_nullifiers.len(), 0, "first nullifier already set"); + assert_eq(self.nullifiers.len(), 0, "first nullifier already set"); let value = self.mock_nullifier_value(0); let first_nullifier = Nullifier { value, counter: 0, note_hash: 0 }.scope(AztecAddress::zero()); - self.new_nullifiers.push(first_nullifier); + self.nullifiers.push(first_nullifier); } pub fn add_nullifier(&mut self, value: Field) { - self.new_nullifiers.push( + self.nullifiers.push( Nullifier { value, counter: self.next_counter(), note_hash: 0 }.scope(self.storage_contract_address) ); } @@ -540,9 +534,9 @@ impl FixtureBuilder { self.add_nullifier(siloed_value); } - pub fn append_new_nullifiers(&mut self, num_extra_nullifier: u32) { - let index_offset = self.new_nullifiers.len(); - for i in 0..self.new_nullifiers.max_len() { + pub fn append_nullifiers(&mut self, num_extra_nullifier: u32) { + let index_offset = self.nullifiers.len(); + for i in 0..self.nullifiers.max_len() { if i < num_extra_nullifier { let value = self.mock_nullifier_value(index_offset + i); self.add_nullifier(value); @@ -551,8 +545,8 @@ impl FixtureBuilder { } pub fn append_siloed_nullifiers(&mut self, num_extra_nullifier: u32) { - let index_offset = self.new_nullifiers.len(); - for i in 0..self.new_nullifiers.max_len() { + let index_offset = self.nullifiers.len(); + for i in 0..self.nullifiers.max_len() { if i < num_extra_nullifier { let value = self.mock_nullifier_value(index_offset + i); self.add_siloed_nullifier(value); @@ -561,7 +555,7 @@ impl FixtureBuilder { } pub fn add_l2_to_l1_message(&mut self, content: Field, recipient: EthAddress) { - self.new_l2_to_l1_msgs.push( + self.l2_to_l1_msgs.push( L2ToL1Message { recipient, content, counter: self.next_counter() }.scope(self.storage_contract_address) ); } @@ -577,9 +571,9 @@ impl FixtureBuilder { self.add_l2_to_l1_message(siloed_content, recipient); } - pub fn append_new_l2_to_l1_msgs(&mut self, num: u32) { - let index_offset = self.new_l2_to_l1_msgs.len(); - for i in 0..self.new_l2_to_l1_msgs.max_len() { + pub fn append_l2_to_l1_msgs(&mut self, num: u32) { + let index_offset = self.l2_to_l1_msgs.len(); + for i in 0..self.l2_to_l1_msgs.max_len() { if i < num { let (content, recipient) = self.mock_l2_to_l1_msg(index_offset + i); self.add_l2_to_l1_message(content, recipient); @@ -588,8 +582,8 @@ impl FixtureBuilder { } pub fn append_siloed_l2_to_l1_msgs(&mut self, num: u32) { - let index_offset = self.new_l2_to_l1_msgs.len(); - for i in 0..self.new_l2_to_l1_msgs.max_len() { + let index_offset = self.l2_to_l1_msgs.len(); + for i in 0..self.l2_to_l1_msgs.max_len() { if i < num { let (content, recipient) = self.mock_l2_to_l1_msg(index_offset + i); self.add_siloed_l2_to_l1_message(content, recipient); @@ -998,9 +992,9 @@ impl Empty for FixtureBuilder { historical_header: Header::empty(), tx_context: TxContext::empty(), global_variables: GlobalVariables::empty(), - new_note_hashes: BoundedVec::new(), - new_nullifiers: BoundedVec::new(), - new_l2_to_l1_msgs: BoundedVec::new(), + note_hashes: BoundedVec::new(), + nullifiers: BoundedVec::new(), + l2_to_l1_msgs: BoundedVec::new(), note_encrypted_logs_hashes: BoundedVec::new(), encrypted_logs_hashes: BoundedVec::new(), unencrypted_logs_hashes: BoundedVec::new(), diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/tests/public_circuit_public_inputs_builder.nr b/noir-projects/noir-protocol-circuits/crates/types/src/tests/public_circuit_public_inputs_builder.nr index e2a97cf3397..50aa8e0aa9d 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/tests/public_circuit_public_inputs_builder.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/tests/public_circuit_public_inputs_builder.nr @@ -11,7 +11,7 @@ use crate::{ use crate::{ constants::{ MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, - MAX_NEW_NOTE_HASHES_PER_CALL, MAX_NEW_L2_TO_L1_MSGS_PER_CALL, MAX_NEW_NULLIFIERS_PER_CALL, + MAX_NOTE_HASHES_PER_CALL, MAX_L2_TO_L1_MSGS_PER_CALL, MAX_NULLIFIERS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_DATA_READS_PER_CALL, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL, MAX_UNENCRYPTED_LOGS_PER_CALL @@ -30,9 +30,9 @@ struct PublicCircuitPublicInputsBuilder { contract_storage_update_requests: BoundedVec, contract_storage_reads: BoundedVec, public_call_stack_hashes: BoundedVec, - new_note_hashes: BoundedVec, - new_nullifiers: BoundedVec, - new_l2_to_l1_msgs: BoundedVec, + note_hashes: BoundedVec, + nullifiers: BoundedVec, + l2_to_l1_msgs: BoundedVec, start_side_effect_counter: u32, end_side_effect_counter: u32, unencrypted_logs_hashes: BoundedVec, @@ -64,9 +64,9 @@ impl PublicCircuitPublicInputsBuilder { contract_storage_update_requests: self.contract_storage_update_requests.storage, contract_storage_reads: self.contract_storage_reads.storage, public_call_stack_hashes: self.public_call_stack_hashes.storage, - new_note_hashes: self.new_note_hashes.storage, - new_nullifiers: self.new_nullifiers.storage, - new_l2_to_l1_msgs: self.new_l2_to_l1_msgs.storage, + note_hashes: self.note_hashes.storage, + nullifiers: self.nullifiers.storage, + l2_to_l1_msgs: self.l2_to_l1_msgs.storage, start_side_effect_counter: self.start_side_effect_counter, end_side_effect_counter: self.end_side_effect_counter, unencrypted_logs_hashes: self.unencrypted_logs_hashes.storage, @@ -94,9 +94,9 @@ impl Empty for PublicCircuitPublicInputsBuilder { contract_storage_update_requests: BoundedVec::new(), contract_storage_reads: BoundedVec::new(), public_call_stack_hashes: BoundedVec::new(), - new_note_hashes: BoundedVec::new(), - new_nullifiers: BoundedVec::new(), - new_l2_to_l1_msgs: BoundedVec::new(), + note_hashes: BoundedVec::new(), + nullifiers: BoundedVec::new(), + l2_to_l1_msgs: BoundedVec::new(), start_side_effect_counter: 0 as u32, end_side_effect_counter: 0 as u32, unencrypted_logs_hashes: BoundedVec::new(), diff --git a/noir/noir-repo/test_programs/execution_success/brillig_cow_regression/src/main.nr b/noir/noir-repo/test_programs/execution_success/brillig_cow_regression/src/main.nr index 7cd50860978..ae3adf6425c 100644 --- a/noir/noir-repo/test_programs/execution_success/brillig_cow_regression/src/main.nr +++ b/noir/noir-repo/test_programs/execution_success/brillig_cow_regression/src/main.nr @@ -1,8 +1,8 @@ // Tests a performance regression found in aztec-packages with brillig cow optimization -global MAX_NEW_NOTE_HASHES_PER_TX: u64 = 64; -global MAX_NEW_NULLIFIERS_PER_TX: u64 = 64; -global MAX_NEW_L2_TO_L1_MSGS_PER_TX: u64 = 2; +global MAX_NOTE_HASHES_PER_TX: u64 = 64; +global MAX_NULLIFIERS_PER_TX: u64 = 64; +global MAX_L2_TO_L1_MSGS_PER_TX: u64 = 2; global MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX: u64 = 16; global MAX_NEW_CONTRACTS_PER_TX: u64 = 1; global NUM_ENCRYPTED_LOGS_HASHES_PER_TX: u64 = 1; @@ -30,10 +30,10 @@ impl NewContractData { } struct DataToHash { - new_note_hashes: [Field; MAX_NEW_NOTE_HASHES_PER_TX], - new_nullifiers: [Field; MAX_NEW_NULLIFIERS_PER_TX], + new_note_hashes: [Field; MAX_NOTE_HASHES_PER_TX], + new_nullifiers: [Field; MAX_NULLIFIERS_PER_TX], public_data_update_requests: [PublicDataUpdateRequest; MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX], - new_l2_to_l1_msgs: [Field; MAX_NEW_L2_TO_L1_MSGS_PER_TX], + new_l2_to_l1_msgs: [Field; MAX_L2_TO_L1_MSGS_PER_TX], encrypted_logs_hash: [Field; NUM_FIELDS_PER_SHA256], unencrypted_logs_hash: [Field; NUM_FIELDS_PER_SHA256], new_contracts: [NewContractData; MAX_NEW_CONTRACTS_PER_TX], @@ -104,21 +104,21 @@ unconstrained fn main(kernel_data: DataToHash) -> pub [Field; NUM_FIELDS_PER_SHA let new_note_hashes = kernel_data.new_note_hashes; let new_nullifiers = kernel_data.new_nullifiers; let public_data_update_requests = kernel_data.public_data_update_requests; - let newL2ToL1msgs = kernel_data.new_l2_to_l1_msgs; + let l2ToL1Msgs = kernel_data.new_l2_to_l1_msgs; let encryptedLogsHash = kernel_data.encrypted_logs_hash; let unencryptedLogsHash = kernel_data.unencrypted_logs_hash; let mut offset = 0; - for j in 0..MAX_NEW_NOTE_HASHES_PER_TX { + for j in 0..MAX_NOTE_HASHES_PER_TX { tx_effects_hash_inputs[offset + j] = new_note_hashes[j]; } - offset += MAX_NEW_NOTE_HASHES_PER_TX ; + offset += MAX_NOTE_HASHES_PER_TX ; - for j in 0..MAX_NEW_NULLIFIERS_PER_TX { + for j in 0..MAX_NULLIFIERS_PER_TX { tx_effects_hash_inputs[offset + j] = new_nullifiers[j]; } - offset += MAX_NEW_NULLIFIERS_PER_TX ; + offset += MAX_NULLIFIERS_PER_TX ; for j in 0..MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX { tx_effects_hash_inputs[offset + j * 2] = @@ -128,10 +128,10 @@ unconstrained fn main(kernel_data: DataToHash) -> pub [Field; NUM_FIELDS_PER_SHA } offset += MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * 2; - for j in 0..MAX_NEW_L2_TO_L1_MSGS_PER_TX { - tx_effects_hash_inputs[offset + j] = newL2ToL1msgs[j]; + for j in 0..MAX_L2_TO_L1_MSGS_PER_TX { + tx_effects_hash_inputs[offset + j] = l2ToL1Msgs[j]; } - offset += MAX_NEW_L2_TO_L1_MSGS_PER_TX; + offset += MAX_L2_TO_L1_MSGS_PER_TX; let contract_leaf = kernel_data.new_contracts[0]; tx_effects_hash_inputs[offset] = contract_leaf.hash(); diff --git a/yarn-project/bb-prover/src/avm_proving.test.ts b/yarn-project/bb-prover/src/avm_proving.test.ts index 5f721dd565b..f821a8266c9 100644 --- a/yarn-project/bb-prover/src/avm_proving.test.ts +++ b/yarn-project/bb-prover/src/avm_proving.test.ts @@ -10,10 +10,10 @@ import { L2ToL1Message, LogHash, MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL, - MAX_NEW_L2_TO_L1_MSGS_PER_CALL, - MAX_NEW_NOTE_HASHES_PER_CALL, - MAX_NEW_NULLIFIERS_PER_CALL, + MAX_L2_TO_L1_MSGS_PER_CALL, + MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, + MAX_NULLIFIERS_PER_CALL, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, @@ -291,9 +291,9 @@ const getPublicInputs = (result: PublicExecutionResult): PublicCircuitPublicInpu callContext: result.executionRequest.callContext, proverAddress: AztecAddress.ZERO, argsHash: computeVarArgsHash(result.executionRequest.args), - newNoteHashes: padArrayEnd(result.newNoteHashes, NoteHash.empty(), MAX_NEW_NOTE_HASHES_PER_CALL), - newNullifiers: padArrayEnd(result.newNullifiers, Nullifier.empty(), MAX_NEW_NULLIFIERS_PER_CALL), - newL2ToL1Msgs: padArrayEnd(result.newL2ToL1Messages, L2ToL1Message.empty(), MAX_NEW_L2_TO_L1_MSGS_PER_CALL), + noteHashes: padArrayEnd(result.noteHashes, NoteHash.empty(), MAX_NOTE_HASHES_PER_CALL), + nullifiers: padArrayEnd(result.nullifiers, Nullifier.empty(), MAX_NULLIFIERS_PER_CALL), + l2ToL1Msgs: padArrayEnd(result.l2ToL1Messages, L2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_CALL), startSideEffectCounter: result.startSideEffectCounter, endSideEffectCounter: result.endSideEffectCounter, returnsHash: computeVarArgsHash(result.returnValues), diff --git a/yarn-project/bb-prover/src/prover/bb_native_proof_creator.ts b/yarn-project/bb-prover/src/prover/bb_native_proof_creator.ts index ea93f78fe77..ecfad7d8ed1 100644 --- a/yarn-project/bb-prover/src/prover/bb_native_proof_creator.ts +++ b/yarn-project/bb-prover/src/prover/bb_native_proof_creator.ts @@ -76,9 +76,7 @@ export class BBNativeProofCreator implements ProofCreator { public getSiloedCommitments(publicInputs: PrivateCircuitPublicInputs) { const contractAddress = publicInputs.callContext.storageContractAddress; - return Promise.resolve( - publicInputs.newNoteHashes.map(commitment => siloNoteHash(contractAddress, commitment.value)), - ); + return Promise.resolve(publicInputs.noteHashes.map(commitment => siloNoteHash(contractAddress, commitment.value))); } public async createProofInit( diff --git a/yarn-project/circuit-types/src/mocks.ts b/yarn-project/circuit-types/src/mocks.ts index 224f1de36c6..a15d73e021e 100644 --- a/yarn-project/circuit-types/src/mocks.ts +++ b/yarn-project/circuit-types/src/mocks.ts @@ -3,7 +3,7 @@ import { CallRequest, GasSettings, LogHash, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, Nullifier, PartialPrivateTailPublicInputsForPublic, @@ -78,11 +78,11 @@ export const mockTx = ( const revertibleBuilder = new PublicAccumulatedDataBuilder(); const nonRevertibleBuilder = new PublicAccumulatedDataBuilder(); - const nonRevertibleNullifiers = makeTuple(MAX_NEW_NULLIFIERS_PER_TX, Nullifier.empty); + const nonRevertibleNullifiers = makeTuple(MAX_NULLIFIERS_PER_TX, Nullifier.empty); nonRevertibleNullifiers[0] = firstNullifier; data.forPublic.endNonRevertibleData = nonRevertibleBuilder - .withNewNullifiers(nonRevertibleNullifiers) + .withNullifiers(nonRevertibleNullifiers) .withPublicCallStack( makeTuple(MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, i => i < numberOfNonRevertiblePublicCallRequests @@ -154,7 +154,7 @@ export const mockTx = ( }); } } else { - data.forRollup!.end.newNullifiers[0] = firstNullifier.value; + data.forRollup!.end.nullifiers[0] = firstNullifier.value; data.forRollup!.end.noteEncryptedLogsHash = Fr.fromBuffer(noteEncryptedLogs.hash()); data.forRollup!.end.encryptedLogsHash = Fr.fromBuffer(encryptedLogs.hash()); data.forRollup!.end.unencryptedLogsHash = Fr.fromBuffer(unencryptedLogs.hash()); diff --git a/yarn-project/circuit-types/src/tx/processed_tx.ts b/yarn-project/circuit-types/src/tx/processed_tx.ts index d20983f261b..bb96b7f5615 100644 --- a/yarn-project/circuit-types/src/tx/processed_tx.ts +++ b/yarn-project/circuit-types/src/tx/processed_tx.ts @@ -234,9 +234,9 @@ export function toTxEffect(tx: ProcessedTx, gasFees: GasFees): TxEffect { return new TxEffect( tx.data.revertCode, tx.data.getTransactionFee(gasFees), - tx.data.end.newNoteHashes.filter(h => !h.isZero()), - tx.data.end.newNullifiers.filter(h => !h.isZero()), - tx.data.end.newL2ToL1Msgs.filter(h => !h.isZero()), + tx.data.end.noteHashes.filter(h => !h.isZero()), + tx.data.end.nullifiers.filter(h => !h.isZero()), + tx.data.end.l2ToL1Msgs.filter(h => !h.isZero()), tx.finalPublicDataUpdateRequests.map(t => new PublicDataWrite(t.leafSlot, t.newValue)).filter(h => !h.isEmpty()), tx.data.end.noteEncryptedLogPreimagesLength, tx.data.end.encryptedLogPreimagesLength, diff --git a/yarn-project/circuit-types/src/tx_effect.ts b/yarn-project/circuit-types/src/tx_effect.ts index bf5fb9d5a31..b707ae23707 100644 --- a/yarn-project/circuit-types/src/tx_effect.ts +++ b/yarn-project/circuit-types/src/tx_effect.ts @@ -7,9 +7,9 @@ import { } from '@aztec/circuit-types'; import { Fr, - MAX_NEW_L2_TO_L1_MSGS_PER_TX, - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_L2_TO_L1_MSGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, RevertCode, } from '@aztec/circuits.js'; @@ -58,8 +58,8 @@ export class TxEffect { ) { // TODO(#4638): Clean this up once we have isDefault() everywhere --> then we don't have to deal with 2 different // functions (isZero and isEmpty) - if (noteHashes.length > MAX_NEW_NOTE_HASHES_PER_TX) { - throw new Error(`Too many note hashes: ${noteHashes.length}, max: ${MAX_NEW_NOTE_HASHES_PER_TX}`); + if (noteHashes.length > MAX_NOTE_HASHES_PER_TX) { + throw new Error(`Too many note hashes: ${noteHashes.length}, max: ${MAX_NOTE_HASHES_PER_TX}`); } noteHashes.forEach(h => { if (h.isZero()) { @@ -67,8 +67,8 @@ export class TxEffect { } }); - if (nullifiers.length > MAX_NEW_NULLIFIERS_PER_TX) { - throw new Error(`Too many nullifiers: ${nullifiers.length}, max: ${MAX_NEW_NULLIFIERS_PER_TX}`); + if (nullifiers.length > MAX_NULLIFIERS_PER_TX) { + throw new Error(`Too many nullifiers: ${nullifiers.length}, max: ${MAX_NULLIFIERS_PER_TX}`); } nullifiers.forEach(h => { if (h.isZero()) { @@ -76,8 +76,8 @@ export class TxEffect { } }); - if (l2ToL1Msgs.length > MAX_NEW_L2_TO_L1_MSGS_PER_TX) { - throw new Error(`Too many L2 to L1 messages: ${l2ToL1Msgs.length}, max: ${MAX_NEW_L2_TO_L1_MSGS_PER_TX}`); + if (l2ToL1Msgs.length > MAX_L2_TO_L1_MSGS_PER_TX) { + throw new Error(`Too many L2 to L1 messages: ${l2ToL1Msgs.length}, max: ${MAX_L2_TO_L1_MSGS_PER_TX}`); } l2ToL1Msgs.forEach(h => { if (h.isZero()) { @@ -146,18 +146,9 @@ export class TxEffect { hash() { const padBuffer = (buf: Buffer, length: number) => Buffer.concat([buf, Buffer.alloc(length - buf.length)]); - const noteHashesBuffer = padBuffer( - serializeToBuffer(this.noteHashes), - Fr.SIZE_IN_BYTES * MAX_NEW_NOTE_HASHES_PER_TX, - ); - const nullifiersBuffer = padBuffer( - serializeToBuffer(this.nullifiers), - Fr.SIZE_IN_BYTES * MAX_NEW_NULLIFIERS_PER_TX, - ); - const l2ToL1MsgsBuffer = padBuffer( - serializeToBuffer(this.l2ToL1Msgs), - Fr.SIZE_IN_BYTES * MAX_NEW_L2_TO_L1_MSGS_PER_TX, - ); + const noteHashesBuffer = padBuffer(serializeToBuffer(this.noteHashes), Fr.SIZE_IN_BYTES * MAX_NOTE_HASHES_PER_TX); + const nullifiersBuffer = padBuffer(serializeToBuffer(this.nullifiers), Fr.SIZE_IN_BYTES * MAX_NULLIFIERS_PER_TX); + const l2ToL1MsgsBuffer = padBuffer(serializeToBuffer(this.l2ToL1Msgs), Fr.SIZE_IN_BYTES * MAX_L2_TO_L1_MSGS_PER_TX); const publicDataWritesBuffer = padBuffer( serializeToBuffer(this.publicDataWrites), PublicDataWrite.SIZE_IN_BYTES * MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, @@ -197,9 +188,9 @@ export class TxEffect { return new TxEffect( RevertCode.random(), Fr.random(), - makeTuple(MAX_NEW_NOTE_HASHES_PER_TX, Fr.random), - makeTuple(MAX_NEW_NULLIFIERS_PER_TX, Fr.random), - makeTuple(MAX_NEW_L2_TO_L1_MSGS_PER_TX, Fr.random), + makeTuple(MAX_NOTE_HASHES_PER_TX, Fr.random), + makeTuple(MAX_NULLIFIERS_PER_TX, Fr.random), + makeTuple(MAX_L2_TO_L1_MSGS_PER_TX, Fr.random), makeTuple(MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, PublicDataWrite.random), new Fr(noteEncryptedLogs.getKernelLength()), new Fr(encryptedLogs.getKernelLength()), diff --git a/yarn-project/circuits.js/src/constants.gen.ts b/yarn-project/circuits.js/src/constants.gen.ts index 6be3599a270..c8bb1f971cd 100644 --- a/yarn-project/circuits.js/src/constants.gen.ts +++ b/yarn-project/circuits.js/src/constants.gen.ts @@ -1,11 +1,11 @@ /* eslint-disable */ // GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants export const ARGS_LENGTH = 16; -export const MAX_NEW_NOTE_HASHES_PER_CALL = 16; -export const MAX_NEW_NULLIFIERS_PER_CALL = 16; +export const MAX_NOTE_HASHES_PER_CALL = 16; +export const MAX_NULLIFIERS_PER_CALL = 16; export const MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL = 4; export const MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL = 16; -export const MAX_NEW_L2_TO_L1_MSGS_PER_CALL = 2; +export const MAX_L2_TO_L1_MSGS_PER_CALL = 2; export const MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL = 32; export const MAX_PUBLIC_DATA_READS_PER_CALL = 32; export const MAX_NOTE_HASH_READ_REQUESTS_PER_CALL = 16; @@ -16,15 +16,15 @@ export const MAX_KEY_VALIDATION_REQUESTS_PER_CALL = 16; export const MAX_NOTE_ENCRYPTED_LOGS_PER_CALL = 16; export const MAX_ENCRYPTED_LOGS_PER_CALL = 4; export const MAX_UNENCRYPTED_LOGS_PER_CALL = 4; -export const MAX_NEW_NOTE_HASHES_PER_TX = 64; -export const MAX_NEW_NULLIFIERS_PER_TX = 64; +export const MAX_NOTE_HASHES_PER_TX = 64; +export const MAX_NULLIFIERS_PER_TX = 64; export const MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX = 8; export const MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX = 32; export const MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX = 63; export const PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX = 1; export const MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX = 64; export const MAX_PUBLIC_DATA_READS_PER_TX = 64; -export const MAX_NEW_L2_TO_L1_MSGS_PER_TX = 8; +export const MAX_L2_TO_L1_MSGS_PER_TX = 8; export const MAX_NOTE_HASH_READ_REQUESTS_PER_TX = 64; export const MAX_NULLIFIER_READ_REQUESTS_PER_TX = 64; export const MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX = 64; diff --git a/yarn-project/circuits.js/src/hints/build_note_hash_read_request_hints.test.ts b/yarn-project/circuits.js/src/hints/build_note_hash_read_request_hints.test.ts index 26d871b060e..9728ca03a03 100644 --- a/yarn-project/circuits.js/src/hints/build_note_hash_read_request_hints.test.ts +++ b/yarn-project/circuits.js/src/hints/build_note_hash_read_request_hints.test.ts @@ -3,7 +3,7 @@ import { AztecAddress } from '@aztec/foundation/aztec-address'; import { Fr } from '@aztec/foundation/fields'; import { type Tuple } from '@aztec/foundation/serialize'; -import { MAX_NEW_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX } from '../constants.gen.js'; +import { MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX } from '../constants.gen.js'; import { siloNoteHash } from '../hash/index.js'; import { NoteHash, @@ -28,7 +28,7 @@ describe('buildNoteHashReadRequestHints', () => { settledLeafIndexes.includes(leafIndex) ? ({} as any) : undefined, }; let noteHashReadRequests: Tuple; - let noteHashes: Tuple; + let noteHashes: Tuple; let noteHashLeafIndexMap: Map = new Map(); let expectedHints: NoteHashReadRequestHints< typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX, @@ -89,7 +89,7 @@ describe('buildNoteHashReadRequestHints', () => { beforeEach(() => { noteHashReadRequests = makeTuple(MAX_NOTE_HASH_READ_REQUESTS_PER_TX, ScopedReadRequest.empty); - noteHashes = makeTuple(MAX_NEW_NOTE_HASHES_PER_TX, i => makeNoteHash(innerNoteHash(i))); + noteHashes = makeTuple(MAX_NOTE_HASHES_PER_TX, i => makeNoteHash(innerNoteHash(i))); noteHashLeafIndexMap = new Map(); expectedHints = NoteHashReadRequestHintsBuilder.empty( MAX_NOTE_HASH_READ_REQUESTS_PER_TX, @@ -98,9 +98,9 @@ describe('buildNoteHashReadRequestHints', () => { numReadRequests = 0; numPendingReads = 0; numSettledReads = 0; - futureNoteHashes = new Array(MAX_NEW_NOTE_HASHES_PER_TX) + futureNoteHashes = new Array(MAX_NOTE_HASHES_PER_TX) .fill(null) - .map((_, i) => makeNoteHash(innerNoteHash(i + MAX_NEW_NOTE_HASHES_PER_TX))); + .map((_, i) => makeNoteHash(innerNoteHash(i + MAX_NOTE_HASHES_PER_TX))); }); it('builds empty hints', async () => { diff --git a/yarn-project/circuits.js/src/hints/build_note_hash_read_request_hints.ts b/yarn-project/circuits.js/src/hints/build_note_hash_read_request_hints.ts index c065e0d422d..60661223a9d 100644 --- a/yarn-project/circuits.js/src/hints/build_note_hash_read_request_hints.ts +++ b/yarn-project/circuits.js/src/hints/build_note_hash_read_request_hints.ts @@ -1,7 +1,7 @@ import { type Tuple } from '@aztec/foundation/serialize'; import { - type MAX_NEW_NOTE_HASHES_PER_TX, + type MAX_NOTE_HASHES_PER_TX, type MAX_NOTE_HASH_READ_REQUESTS_PER_TX, type NOTE_HASH_TREE_HEIGHT, } from '../constants.gen.js'; @@ -29,7 +29,7 @@ export async function buildNoteHashReadRequestHints>; }, noteHashReadRequests: Tuple, - noteHashes: Tuple, + noteHashes: Tuple, noteHashLeafIndexMap: Map, sizePending: PENDING, sizeSettled: SETTLED, diff --git a/yarn-project/circuits.js/src/hints/build_nullifier_non_existent_read_request_hints.test.ts b/yarn-project/circuits.js/src/hints/build_nullifier_non_existent_read_request_hints.test.ts index 7c5834fe945..beb031fb259 100644 --- a/yarn-project/circuits.js/src/hints/build_nullifier_non_existent_read_request_hints.test.ts +++ b/yarn-project/circuits.js/src/hints/build_nullifier_non_existent_read_request_hints.test.ts @@ -3,7 +3,7 @@ import { AztecAddress } from '@aztec/foundation/aztec-address'; import { padArrayEnd } from '@aztec/foundation/collection'; import { Fr } from '@aztec/foundation/fields'; -import { MAX_NEW_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX } from '../constants.gen.js'; +import { MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX } from '../constants.gen.js'; import { siloNullifier } from '../hash/index.js'; import { Nullifier, @@ -19,7 +19,7 @@ describe('buildNullifierNonExistentReadRequestHints', () => { getLowNullifierMembershipWitness: () => ({ membershipWitness: {}, leafPreimage: {} } as any), }; const nonExistentReadRequests = makeTuple(MAX_NULLIFIER_READ_REQUESTS_PER_TX, ScopedReadRequest.empty); - let nullifiers = makeTuple(MAX_NEW_NULLIFIERS_PER_TX, Nullifier.empty); + let nullifiers = makeTuple(MAX_NULLIFIERS_PER_TX, Nullifier.empty); const innerNullifier = (index: number) => index + 1; @@ -36,8 +36,8 @@ describe('buildNullifierNonExistentReadRequestHints', () => { siloedValue: Fr; } - const populateNullifiers = (numNullifiers = MAX_NEW_NULLIFIERS_PER_TX) => { - nullifiers = makeTuple(MAX_NEW_NULLIFIERS_PER_TX, i => + const populateNullifiers = (numNullifiers = MAX_NULLIFIERS_PER_TX) => { + nullifiers = makeTuple(MAX_NULLIFIERS_PER_TX, i => i < numNullifiers ? makeNullifier(innerNullifier(i)) : Nullifier.empty(), ); }; @@ -77,7 +77,7 @@ describe('buildNullifierNonExistentReadRequestHints', () => { }); it('builds hints for half-full sorted nullifiers', async () => { - const numNonEmptyNullifiers = MAX_NEW_NULLIFIERS_PER_TX / 2; + const numNonEmptyNullifiers = MAX_NULLIFIERS_PER_TX / 2; populateNullifiers(numNonEmptyNullifiers); const hints = await buildHints(); @@ -103,7 +103,7 @@ describe('buildNullifierNonExistentReadRequestHints', () => { }); it('builds hints for read requests', async () => { - const numNonEmptyNullifiers = MAX_NEW_NULLIFIERS_PER_TX / 2; + const numNonEmptyNullifiers = MAX_NULLIFIERS_PER_TX / 2; expect(numNonEmptyNullifiers > 1).toBe(true); // Need at least 2 nullifiers to test a value in the middle. const sortedNullifiers = generateSortedNullifiers(numNonEmptyNullifiers + 3); @@ -118,7 +118,7 @@ describe('buildNullifierNonExistentReadRequestHints', () => { nullifiers = padArrayEnd( sortedNullifiers.map(n => makeNullifier(n.value)), Nullifier.empty(), - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NULLIFIERS_PER_TX, ); const hints = await buildHints(); diff --git a/yarn-project/circuits.js/src/hints/build_nullifier_non_existent_read_request_hints.ts b/yarn-project/circuits.js/src/hints/build_nullifier_non_existent_read_request_hints.ts index b2393cf4bc4..d217864333d 100644 --- a/yarn-project/circuits.js/src/hints/build_nullifier_non_existent_read_request_hints.ts +++ b/yarn-project/circuits.js/src/hints/build_nullifier_non_existent_read_request_hints.ts @@ -4,7 +4,7 @@ import { type Tuple } from '@aztec/foundation/serialize'; import { type IndexedTreeLeafPreimage } from '@aztec/foundation/trees'; import { - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NULLIFIERS_PER_TX, type MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX, type NULLIFIER_TREE_HEIGHT, } from '../constants.gen.js'; @@ -26,8 +26,8 @@ interface SortedResult { } function sortNullifiersByValues( - nullifiers: Tuple, -): SortedResult { + nullifiers: Tuple, +): SortedResult { const numNullifiers = countAccumulatedItems(nullifiers); const sorted = nullifiers .slice(0, numNullifiers) @@ -43,9 +43,9 @@ function sortNullifiersByValues( sortedValues: padArrayEnd( sorted.map(s => s.nullifier), Nullifier.empty(), - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NULLIFIERS_PER_TX, ), - sortedIndexHints: padArrayEnd(sortedIndexHints, 0, MAX_NEW_NULLIFIERS_PER_TX), + sortedIndexHints: padArrayEnd(sortedIndexHints, 0, MAX_NULLIFIERS_PER_TX), }; } @@ -54,7 +54,7 @@ export async function buildNullifierNonExistentReadRequestHints( getLowNullifierMembershipWitness(nullifier: Fr): Promise; }, nullifierNonExistentReadRequests: Tuple, - pendingNullifiers: Tuple, + pendingNullifiers: Tuple, ) { const { sortedValues, sortedIndexHints } = sortNullifiersByValues(pendingNullifiers); diff --git a/yarn-project/circuits.js/src/hints/build_nullifier_read_request_hints.test.ts b/yarn-project/circuits.js/src/hints/build_nullifier_read_request_hints.test.ts index 4e418633edc..4561ed2ef42 100644 --- a/yarn-project/circuits.js/src/hints/build_nullifier_read_request_hints.test.ts +++ b/yarn-project/circuits.js/src/hints/build_nullifier_read_request_hints.test.ts @@ -3,7 +3,7 @@ import { AztecAddress } from '@aztec/foundation/aztec-address'; import { Fr } from '@aztec/foundation/fields'; import { type Tuple } from '@aztec/foundation/serialize'; -import { MAX_NEW_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX } from '../constants.gen.js'; +import { MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX } from '../constants.gen.js'; import { Nullifier, type NullifierReadRequestHints, @@ -25,7 +25,7 @@ describe('buildNullifierReadRequestHints', () => { getNullifierMembershipWitness: () => ({ membershipWitness: {}, leafPreimage: {} } as any), }; let nullifierReadRequests: Tuple; - let nullifiers: Tuple; + let nullifiers: Tuple; let expectedHints: NullifierReadRequestHints< typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX @@ -93,7 +93,7 @@ describe('buildNullifierReadRequestHints', () => { beforeEach(() => { nullifierReadRequests = makeTuple(MAX_NULLIFIER_READ_REQUESTS_PER_TX, ScopedReadRequest.empty); - nullifiers = makeTuple(MAX_NEW_NULLIFIERS_PER_TX, i => makeNullifier(innerNullifier(i))); + nullifiers = makeTuple(MAX_NULLIFIERS_PER_TX, i => makeNullifier(innerNullifier(i))); expectedHints = NullifierReadRequestHintsBuilder.empty( MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, @@ -101,9 +101,9 @@ describe('buildNullifierReadRequestHints', () => { numReadRequests = 0; numPendingReads = 0; numSettledReads = 0; - futureNullifiers = new Array(MAX_NEW_NULLIFIERS_PER_TX) + futureNullifiers = new Array(MAX_NULLIFIERS_PER_TX) .fill(null) - .map((_, i) => makeNullifier(innerNullifier(i + MAX_NEW_NULLIFIERS_PER_TX))); + .map((_, i) => makeNullifier(innerNullifier(i + MAX_NULLIFIERS_PER_TX))); }); it('builds empty hints', async () => { diff --git a/yarn-project/circuits.js/src/hints/build_nullifier_read_request_hints.ts b/yarn-project/circuits.js/src/hints/build_nullifier_read_request_hints.ts index a7adfca91cf..d9e9672045e 100644 --- a/yarn-project/circuits.js/src/hints/build_nullifier_read_request_hints.ts +++ b/yarn-project/circuits.js/src/hints/build_nullifier_read_request_hints.ts @@ -5,7 +5,7 @@ import { type Tuple } from '@aztec/foundation/serialize'; import { type IndexedTreeLeafPreimage } from '@aztec/foundation/trees'; import { - type MAX_NEW_NULLIFIERS_PER_TX, + type MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, type NULLIFIER_TREE_HEIGHT, } from '../constants.gen.js'; @@ -39,7 +39,7 @@ export async function buildNullifierReadRequestHints; }, nullifierReadRequests: Tuple, - nullifiers: Tuple, + nullifiers: Tuple, sizePending: PENDING, sizeSettled: SETTLED, futureNullifiers: ScopedNullifier[], @@ -89,7 +89,7 @@ export function buildSiloedNullifierReadRequestHints; }, nullifierReadRequests: Tuple, - nullifiers: Tuple, + nullifiers: Tuple, sizePending: PENDING, sizeSettled: SETTLED, ) { @@ -105,7 +105,7 @@ export function buildSiloedNullifierReadRequestHints new Nullifier(n.value, n.counter, n.noteHash).scope(AztecAddress.ZERO), - ) as Tuple; + ) as Tuple; return buildNullifierReadRequestHints( oracle, diff --git a/yarn-project/circuits.js/src/scripts/constants.in.ts b/yarn-project/circuits.js/src/scripts/constants.in.ts index d8e01ac1dcd..119eafb4fc8 100644 --- a/yarn-project/circuits.js/src/scripts/constants.in.ts +++ b/yarn-project/circuits.js/src/scripts/constants.in.ts @@ -34,11 +34,11 @@ const CPP_CONSTANTS = [ 'MAX_PUBLIC_DATA_READS_PER_CALL', 'MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL', 'NOTE_HASH_LENGTH', - 'MAX_NEW_NOTE_HASHES_PER_CALL', + 'MAX_NOTE_HASHES_PER_CALL', 'NULLIFIER_LENGTH', - 'MAX_NEW_NULLIFIERS_PER_CALL', + 'MAX_NULLIFIERS_PER_CALL', 'L2_TO_L1_MESSAGE_LENGTH', - 'MAX_NEW_L2_TO_L1_MSGS_PER_CALL', + 'MAX_L2_TO_L1_MSGS_PER_CALL', 'LOG_HASH_LENGTH', 'MAX_UNENCRYPTED_LOGS_PER_CALL', 'HEADER_LENGTH', @@ -79,9 +79,9 @@ const PIL_CONSTANTS = [ 'MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL', 'MAX_PUBLIC_DATA_READS_PER_CALL', 'MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL', - 'MAX_NEW_NOTE_HASHES_PER_CALL', - 'MAX_NEW_NULLIFIERS_PER_CALL', - 'MAX_NEW_L2_TO_L1_MSGS_PER_CALL', + 'MAX_NOTE_HASHES_PER_CALL', + 'MAX_NULLIFIERS_PER_CALL', + 'MAX_L2_TO_L1_MSGS_PER_CALL', 'MAX_UNENCRYPTED_LOGS_PER_CALL', 'START_NOTE_HASH_EXISTS_WRITE_OFFSET', 'START_NULLIFIER_EXISTS_OFFSET', diff --git a/yarn-project/circuits.js/src/structs/kernel/combine_hints.ts b/yarn-project/circuits.js/src/structs/kernel/combine_hints.ts index b07195f0106..b999251e551 100644 --- a/yarn-project/circuits.js/src/structs/kernel/combine_hints.ts +++ b/yarn-project/circuits.js/src/structs/kernel/combine_hints.ts @@ -6,7 +6,7 @@ import { inspect } from 'util'; import { MAX_ENCRYPTED_LOGS_PER_TX, - MAX_NEW_NOTE_HASHES_PER_TX, + MAX_NOTE_HASHES_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX, } from '../../constants.gen.js'; @@ -24,8 +24,8 @@ import { type PublicAccumulatedData } from './public_accumulated_data.js'; export class CombineHints { constructor( - public readonly sortedNoteHashes: Tuple, - public readonly sortedNoteHashesIndexes: Tuple, + public readonly sortedNoteHashes: Tuple, + public readonly sortedNoteHashesIndexes: Tuple, public readonly sortedUnencryptedLogsHashes: Tuple, public readonly sortedUnencryptedLogsHashesIndexes: Tuple, public readonly sortedPublicDataUpdateRequests: Tuple< @@ -64,8 +64,8 @@ export class CombineHints { static fromBuffer(buffer: Buffer | BufferReader) { const reader = BufferReader.asReader(buffer); return new CombineHints( - reader.readArray(MAX_NEW_NOTE_HASHES_PER_TX, NoteHash), - reader.readNumbers(MAX_NEW_NOTE_HASHES_PER_TX), + reader.readArray(MAX_NOTE_HASHES_PER_TX, NoteHash), + reader.readNumbers(MAX_NOTE_HASHES_PER_TX), reader.readArray(MAX_UNENCRYPTED_LOGS_PER_TX, LogHash), reader.readNumbers(MAX_UNENCRYPTED_LOGS_PER_TX), reader.readArray(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, PublicDataUpdateRequest), @@ -83,14 +83,14 @@ export class CombineHints { nonRevertibleData: PublicAccumulatedData; }): CombineHints { const mergedNoteHashes = mergeAccumulatedData( - nonRevertibleData.newNoteHashes, - revertibleData.newNoteHashes, - MAX_NEW_NOTE_HASHES_PER_TX, + nonRevertibleData.noteHashes, + revertibleData.noteHashes, + MAX_NOTE_HASHES_PER_TX, ); const [sortedNoteHashes, sortedNoteHashesIndexes] = sortByCounterGetSortedHints( mergedNoteHashes, - MAX_NEW_NOTE_HASHES_PER_TX, + MAX_NOTE_HASHES_PER_TX, ); const unencryptedLogHashes = mergeAccumulatedData( diff --git a/yarn-project/circuits.js/src/structs/kernel/combined_accumulated_data.ts b/yarn-project/circuits.js/src/structs/kernel/combined_accumulated_data.ts index 115052dd95b..1adc6ae26c9 100644 --- a/yarn-project/circuits.js/src/structs/kernel/combined_accumulated_data.ts +++ b/yarn-project/circuits.js/src/structs/kernel/combined_accumulated_data.ts @@ -6,9 +6,9 @@ import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/s import { inspect } from 'util'; import { - MAX_NEW_L2_TO_L1_MSGS_PER_TX, - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_L2_TO_L1_MSGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, } from '../../constants.gen.js'; import { Gas } from '../gas.js'; @@ -22,15 +22,15 @@ export class CombinedAccumulatedData { /** * The new note hashes made in this transaction. */ - public newNoteHashes: Tuple, + public noteHashes: Tuple, /** * The new nullifiers made in this transaction. */ - public newNullifiers: Tuple, + public nullifiers: Tuple, /** * All the new L2 to L1 messages created in this transaction. */ - public newL2ToL1Msgs: Tuple, + public l2ToL1Msgs: Tuple, /** * Accumulated encrypted note logs hash from all the previous kernel iterations. * Note: Truncated to 31 bytes to fit in Fr. @@ -69,9 +69,9 @@ export class CombinedAccumulatedData { getSize() { return ( - arraySerializedSizeOfNonEmpty(this.newNoteHashes) + - arraySerializedSizeOfNonEmpty(this.newNullifiers) + - arraySerializedSizeOfNonEmpty(this.newL2ToL1Msgs) + + arraySerializedSizeOfNonEmpty(this.noteHashes) + + arraySerializedSizeOfNonEmpty(this.nullifiers) + + arraySerializedSizeOfNonEmpty(this.l2ToL1Msgs) + this.noteEncryptedLogsHash.size + this.encryptedLogsHash.size + this.unencryptedLogsHash.size + @@ -85,9 +85,9 @@ export class CombinedAccumulatedData { static getFields(fields: FieldsOf) { return [ - fields.newNoteHashes, - fields.newNullifiers, - fields.newL2ToL1Msgs, + fields.noteHashes, + fields.nullifiers, + fields.l2ToL1Msgs, fields.noteEncryptedLogsHash, fields.encryptedLogsHash, fields.unencryptedLogsHash, @@ -119,9 +119,9 @@ export class CombinedAccumulatedData { static fromBuffer(buffer: Buffer | BufferReader): CombinedAccumulatedData { const reader = BufferReader.asReader(buffer); return new CombinedAccumulatedData( - reader.readArray(MAX_NEW_NOTE_HASHES_PER_TX, Fr), - reader.readArray(MAX_NEW_NULLIFIERS_PER_TX, Fr), - reader.readArray(MAX_NEW_L2_TO_L1_MSGS_PER_TX, Fr), + reader.readArray(MAX_NOTE_HASHES_PER_TX, Fr), + reader.readArray(MAX_NULLIFIERS_PER_TX, Fr), + reader.readArray(MAX_L2_TO_L1_MSGS_PER_TX, Fr), Fr.fromBuffer(reader), Fr.fromBuffer(reader), Fr.fromBuffer(reader), @@ -144,9 +144,9 @@ export class CombinedAccumulatedData { static empty() { return new CombinedAccumulatedData( - makeTuple(MAX_NEW_NOTE_HASHES_PER_TX, Fr.zero), - makeTuple(MAX_NEW_NULLIFIERS_PER_TX, Fr.zero), - makeTuple(MAX_NEW_L2_TO_L1_MSGS_PER_TX, Fr.zero), + makeTuple(MAX_NOTE_HASHES_PER_TX, Fr.zero), + makeTuple(MAX_NULLIFIERS_PER_TX, Fr.zero), + makeTuple(MAX_L2_TO_L1_MSGS_PER_TX, Fr.zero), Fr.zero(), Fr.zero(), Fr.zero(), @@ -160,15 +160,15 @@ export class CombinedAccumulatedData { [inspect.custom]() { return `CombinedAccumulatedData { - newNoteHashes: [${this.newNoteHashes + noteHashes: [${this.noteHashes .filter(x => !x.isZero()) .map(x => inspect(x)) .join(', ')}], - newNullifiers: [${this.newNullifiers + nullifiers: [${this.nullifiers .filter(x => !x.isZero()) .map(x => inspect(x)) .join(', ')}], - newL2ToL1Msgs: [${this.newL2ToL1Msgs + l2ToL1Msgs: [${this.l2ToL1Msgs .filter(x => !x.isZero()) .map(x => inspect(x)) .join(', ')}], diff --git a/yarn-project/circuits.js/src/structs/kernel/kernel_circuit_public_inputs.ts b/yarn-project/circuits.js/src/structs/kernel/kernel_circuit_public_inputs.ts index 710c34fc68b..e729c2accd9 100644 --- a/yarn-project/circuits.js/src/structs/kernel/kernel_circuit_public_inputs.ts +++ b/yarn-project/circuits.js/src/structs/kernel/kernel_circuit_public_inputs.ts @@ -39,7 +39,7 @@ export class KernelCircuitPublicInputs { ) {} getNonEmptyNullifiers() { - return this.end.newNullifiers.filter(n => !n.isZero()); + return this.end.nullifiers.filter(n => !n.isZero()); } /** diff --git a/yarn-project/circuits.js/src/structs/kernel/private_accumulated_data.ts b/yarn-project/circuits.js/src/structs/kernel/private_accumulated_data.ts index 87a4fd10961..7fd67916f4c 100644 --- a/yarn-project/circuits.js/src/structs/kernel/private_accumulated_data.ts +++ b/yarn-project/circuits.js/src/structs/kernel/private_accumulated_data.ts @@ -3,10 +3,10 @@ import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/s import { MAX_ENCRYPTED_LOGS_PER_TX, - MAX_NEW_L2_TO_L1_MSGS_PER_TX, - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX, @@ -27,15 +27,15 @@ export class PrivateAccumulatedData { /** * The new note hashes made in this transaction. */ - public newNoteHashes: Tuple, + public noteHashes: Tuple, /** * The new nullifiers made in this transaction. */ - public newNullifiers: Tuple, + public nullifiers: Tuple, /** * All the new L2 to L1 messages created in this transaction. */ - public newL2ToL1Msgs: Tuple, + public l2ToL1Msgs: Tuple, /** * Accumulated encrypted note logs hashes from all the previous kernel iterations. * Note: Truncated to 31 bytes to fit in Fr. @@ -63,9 +63,9 @@ export class PrivateAccumulatedData { toBuffer() { return serializeToBuffer( - this.newNoteHashes, - this.newNullifiers, - this.newL2ToL1Msgs, + this.noteHashes, + this.nullifiers, + this.l2ToL1Msgs, this.noteEncryptedLogsHashes, this.encryptedLogsHashes, this.unencryptedLogsHashes, @@ -86,9 +86,9 @@ export class PrivateAccumulatedData { static fromBuffer(buffer: Buffer | BufferReader): PrivateAccumulatedData { const reader = BufferReader.asReader(buffer); return new PrivateAccumulatedData( - reader.readArray(MAX_NEW_NOTE_HASHES_PER_TX, ScopedNoteHash), - reader.readArray(MAX_NEW_NULLIFIERS_PER_TX, ScopedNullifier), - reader.readArray(MAX_NEW_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message), + reader.readArray(MAX_NOTE_HASHES_PER_TX, ScopedNoteHash), + reader.readArray(MAX_NULLIFIERS_PER_TX, ScopedNullifier), + reader.readArray(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message), reader.readArray(MAX_NOTE_ENCRYPTED_LOGS_PER_TX, NoteLogHash), reader.readArray(MAX_ENCRYPTED_LOGS_PER_TX, ScopedEncryptedLogHash), reader.readArray(MAX_UNENCRYPTED_LOGS_PER_TX, ScopedLogHash), @@ -108,9 +108,9 @@ export class PrivateAccumulatedData { static empty() { return new PrivateAccumulatedData( - makeTuple(MAX_NEW_NOTE_HASHES_PER_TX, ScopedNoteHash.empty), - makeTuple(MAX_NEW_NULLIFIERS_PER_TX, ScopedNullifier.empty), - makeTuple(MAX_NEW_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message.empty), + makeTuple(MAX_NOTE_HASHES_PER_TX, ScopedNoteHash.empty), + makeTuple(MAX_NULLIFIERS_PER_TX, ScopedNullifier.empty), + makeTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message.empty), makeTuple(MAX_NOTE_ENCRYPTED_LOGS_PER_TX, NoteLogHash.empty), makeTuple(MAX_ENCRYPTED_LOGS_PER_TX, ScopedEncryptedLogHash.empty), makeTuple(MAX_UNENCRYPTED_LOGS_PER_TX, ScopedLogHash.empty), diff --git a/yarn-project/circuits.js/src/structs/kernel/private_kernel_init_circuit_private_inputs.ts b/yarn-project/circuits.js/src/structs/kernel/private_kernel_init_circuit_private_inputs.ts index 57d1a88ddfe..52841aa52b4 100644 --- a/yarn-project/circuits.js/src/structs/kernel/private_kernel_init_circuit_private_inputs.ts +++ b/yarn-project/circuits.js/src/structs/kernel/private_kernel_init_circuit_private_inputs.ts @@ -1,11 +1,11 @@ import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/serialize'; -import { MAX_NEW_NOTE_HASHES_PER_CALL } from '../../constants.gen.js'; +import { MAX_NOTE_HASHES_PER_CALL } from '../../constants.gen.js'; import { TxRequest } from '../tx_request.js'; import { PrivateCallData } from './private_call_data.js'; export class PrivateKernelInitHints { - constructor(public noteHashNullifierCounters: Tuple) {} + constructor(public noteHashNullifierCounters: Tuple) {} toBuffer() { return serializeToBuffer(this.noteHashNullifierCounters); @@ -13,7 +13,7 @@ export class PrivateKernelInitHints { static fromBuffer(buffer: Buffer | BufferReader) { const reader = BufferReader.asReader(buffer); - return new PrivateKernelInitHints(reader.readNumbers(MAX_NEW_NOTE_HASHES_PER_CALL)); + return new PrivateKernelInitHints(reader.readNumbers(MAX_NOTE_HASHES_PER_CALL)); } } diff --git a/yarn-project/circuits.js/src/structs/kernel/private_kernel_inner_circuit_private_inputs.ts b/yarn-project/circuits.js/src/structs/kernel/private_kernel_inner_circuit_private_inputs.ts index 877263c6f4c..c93964624f1 100644 --- a/yarn-project/circuits.js/src/structs/kernel/private_kernel_inner_circuit_private_inputs.ts +++ b/yarn-project/circuits.js/src/structs/kernel/private_kernel_inner_circuit_private_inputs.ts @@ -1,11 +1,11 @@ import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/serialize'; -import { MAX_NEW_NOTE_HASHES_PER_CALL } from '../../constants.gen.js'; +import { MAX_NOTE_HASHES_PER_CALL } from '../../constants.gen.js'; import { PrivateCallData } from './private_call_data.js'; import { PrivateKernelData } from './private_kernel_data.js'; export class PrivateKernelInnerHints { - constructor(public noteHashNullifierCounters: Tuple) {} + constructor(public noteHashNullifierCounters: Tuple) {} toBuffer() { return serializeToBuffer(this.noteHashNullifierCounters); @@ -13,7 +13,7 @@ export class PrivateKernelInnerHints { static fromBuffer(buffer: Buffer | BufferReader) { const reader = BufferReader.asReader(buffer); - return new PrivateKernelInnerHints(reader.readNumbers(MAX_NEW_NOTE_HASHES_PER_CALL)); + return new PrivateKernelInnerHints(reader.readNumbers(MAX_NOTE_HASHES_PER_CALL)); } } diff --git a/yarn-project/circuits.js/src/structs/kernel/private_kernel_reset_circuit_private_inputs.ts b/yarn-project/circuits.js/src/structs/kernel/private_kernel_reset_circuit_private_inputs.ts index a35c33f9730..13c3cc47232 100644 --- a/yarn-project/circuits.js/src/structs/kernel/private_kernel_reset_circuit_private_inputs.ts +++ b/yarn-project/circuits.js/src/structs/kernel/private_kernel_reset_circuit_private_inputs.ts @@ -1,10 +1,6 @@ import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/serialize'; -import { - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, - MAX_NOTE_ENCRYPTED_LOGS_PER_TX, -} from '../../constants.gen.js'; +import { MAX_NOTE_ENCRYPTED_LOGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX } from '../../constants.gen.js'; import { countAccumulatedItems } from '../../utils/index.js'; import { NoteLogHash } from '../log_hash.js'; import { ScopedNoteHash } from '../note_hash.js'; @@ -20,8 +16,8 @@ import { PrivateKernelData } from './private_kernel_data.js'; export class PrivateKernelResetOutputs { constructor( - public noteHashes: Tuple, - public nullifiers: Tuple, + public noteHashes: Tuple, + public nullifiers: Tuple, public noteEncryptedLogHashes: Tuple, ) {} @@ -32,8 +28,8 @@ export class PrivateKernelResetOutputs { static fromBuffer(buffer: Buffer | BufferReader) { const reader = BufferReader.asReader(buffer); return new PrivateKernelResetOutputs( - reader.readArray(MAX_NEW_NOTE_HASHES_PER_TX, ScopedNoteHash), - reader.readArray(MAX_NEW_NULLIFIERS_PER_TX, ScopedNullifier), + reader.readArray(MAX_NOTE_HASHES_PER_TX, ScopedNoteHash), + reader.readArray(MAX_NULLIFIERS_PER_TX, ScopedNullifier), reader.readArray(MAX_NOTE_ENCRYPTED_LOGS_PER_TX, NoteLogHash), ); } @@ -50,11 +46,11 @@ export class PrivateKernelResetHints< /** * Contains hints for the transient note hashes to locate corresponding nullifiers. */ - public transientNullifierIndexesForNoteHashes: Tuple, + public transientNullifierIndexesForNoteHashes: Tuple, /** * Contains hints for the transient nullifiers to locate corresponding note hashes. */ - public transientNoteHashIndexesForNullifiers: Tuple, + public transientNoteHashIndexesForNullifiers: Tuple, /** * Contains hints for the transient logs to locate corresponding note hashes. */ @@ -136,8 +132,8 @@ export class PrivateKernelResetHints< ): PrivateKernelResetHints { const reader = BufferReader.asReader(buffer); return new PrivateKernelResetHints( - reader.readNumbers(MAX_NEW_NOTE_HASHES_PER_TX), - reader.readNumbers(MAX_NEW_NULLIFIERS_PER_TX), + reader.readNumbers(MAX_NOTE_HASHES_PER_TX), + reader.readNumbers(MAX_NULLIFIERS_PER_TX), reader.readNumbers(MAX_NOTE_ENCRYPTED_LOGS_PER_TX), reader.readObject({ fromBuffer: buf => diff --git a/yarn-project/circuits.js/src/structs/kernel/private_kernel_tail_circuit_public_inputs.ts b/yarn-project/circuits.js/src/structs/kernel/private_kernel_tail_circuit_public_inputs.ts index c11e6981aa6..1c60ce004aa 100644 --- a/yarn-project/circuits.js/src/structs/kernel/private_kernel_tail_circuit_public_inputs.ts +++ b/yarn-project/circuits.js/src/structs/kernel/private_kernel_tail_circuit_public_inputs.ts @@ -194,19 +194,19 @@ export class PrivateKernelTailCircuitPublicInputs { getNonEmptyNoteHashes() { const noteHashes = this.forPublic - ? mergeAccumulatedData(this.forPublic.endNonRevertibleData.newNoteHashes, this.forPublic.end.newNoteHashes).map( + ? mergeAccumulatedData(this.forPublic.endNonRevertibleData.noteHashes, this.forPublic.end.noteHashes).map( n => n.value, ) - : this.forRollup!.end.newNoteHashes; + : this.forRollup!.end.noteHashes; return noteHashes.filter(n => !n.isZero()); } getNonEmptyNullifiers() { const nullifiers = this.forPublic - ? mergeAccumulatedData(this.forPublic.endNonRevertibleData.newNullifiers, this.forPublic.end.newNullifiers).map( + ? mergeAccumulatedData(this.forPublic.endNonRevertibleData.nullifiers, this.forPublic.end.nullifiers).map( n => n.value, ) - : this.forRollup!.end.newNullifiers; + : this.forRollup!.end.nullifiers; return nullifiers.filter(n => !n.isZero()); } diff --git a/yarn-project/circuits.js/src/structs/kernel/public_accumulated_data.ts b/yarn-project/circuits.js/src/structs/kernel/public_accumulated_data.ts index 29fb8928da2..2ca2bb57322 100644 --- a/yarn-project/circuits.js/src/structs/kernel/public_accumulated_data.ts +++ b/yarn-project/circuits.js/src/structs/kernel/public_accumulated_data.ts @@ -7,10 +7,10 @@ import { inspect } from 'util'; import { MAX_ENCRYPTED_LOGS_PER_TX, - MAX_NEW_L2_TO_L1_MSGS_PER_TX, - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX, @@ -27,15 +27,15 @@ export class PublicAccumulatedData { /** * The new note hashes made in this transaction. */ - public readonly newNoteHashes: Tuple, + public readonly noteHashes: Tuple, /** * The new nullifiers made in this transaction. */ - public readonly newNullifiers: Tuple, + public readonly nullifiers: Tuple, /** * All the new L2 to L1 messages created in this transaction. */ - public readonly newL2ToL1Msgs: Tuple, + public readonly l2ToL1Msgs: Tuple, /** * Accumulated encrypted note logs hashes from all the previous kernel iterations. * Note: Truncated to 31 bytes to fit in Fr. @@ -69,9 +69,9 @@ export class PublicAccumulatedData { getSize() { return ( - arraySerializedSizeOfNonEmpty(this.newNoteHashes) + - arraySerializedSizeOfNonEmpty(this.newNullifiers) + - arraySerializedSizeOfNonEmpty(this.newL2ToL1Msgs) + + arraySerializedSizeOfNonEmpty(this.noteHashes) + + arraySerializedSizeOfNonEmpty(this.nullifiers) + + arraySerializedSizeOfNonEmpty(this.l2ToL1Msgs) + arraySerializedSizeOfNonEmpty(this.noteEncryptedLogsHashes) + arraySerializedSizeOfNonEmpty(this.encryptedLogsHashes) + arraySerializedSizeOfNonEmpty(this.unencryptedLogsHashes) + @@ -83,9 +83,9 @@ export class PublicAccumulatedData { toBuffer() { return serializeToBuffer( - this.newNoteHashes, - this.newNullifiers, - this.newL2ToL1Msgs, + this.noteHashes, + this.nullifiers, + this.l2ToL1Msgs, this.noteEncryptedLogsHashes, this.encryptedLogsHashes, this.unencryptedLogsHashes, @@ -101,9 +101,9 @@ export class PublicAccumulatedData { isEmpty(): boolean { return ( - this.newNoteHashes.every(x => x.isEmpty()) && - this.newNullifiers.every(x => x.isEmpty()) && - this.newL2ToL1Msgs.every(x => x.isZero()) && + this.noteHashes.every(x => x.isEmpty()) && + this.nullifiers.every(x => x.isEmpty()) && + this.l2ToL1Msgs.every(x => x.isZero()) && this.noteEncryptedLogsHashes.every(x => x.isEmpty()) && this.encryptedLogsHashes.every(x => x.isEmpty()) && this.unencryptedLogsHashes.every(x => x.isEmpty()) && @@ -116,15 +116,15 @@ export class PublicAccumulatedData { [inspect.custom]() { // print out the non-empty fields return `PublicAccumulatedData { - newNoteHashes: [${this.newNoteHashes + noteHashes: [${this.noteHashes .filter(x => !x.isEmpty()) .map(h => inspect(h)) .join(', ')}], - newNullifiers: [${this.newNullifiers + nullifiers: [${this.nullifiers .filter(x => !x.isEmpty()) .map(h => inspect(h)) .join(', ')}], - newL2ToL1Msgs: [${this.newL2ToL1Msgs + l2ToL1Msgs: [${this.l2ToL1Msgs .filter(x => !x.isZero()) .map(h => inspect(h)) .join(', ')}], @@ -160,9 +160,9 @@ export class PublicAccumulatedData { static fromBuffer(buffer: Buffer | BufferReader) { const reader = BufferReader.asReader(buffer); return new this( - reader.readArray(MAX_NEW_NOTE_HASHES_PER_TX, NoteHash), - reader.readArray(MAX_NEW_NULLIFIERS_PER_TX, Nullifier), - reader.readArray(MAX_NEW_L2_TO_L1_MSGS_PER_TX, Fr), + reader.readArray(MAX_NOTE_HASHES_PER_TX, NoteHash), + reader.readArray(MAX_NULLIFIERS_PER_TX, Nullifier), + reader.readArray(MAX_L2_TO_L1_MSGS_PER_TX, Fr), reader.readArray(MAX_NOTE_ENCRYPTED_LOGS_PER_TX, LogHash), reader.readArray(MAX_ENCRYPTED_LOGS_PER_TX, LogHash), reader.readArray(MAX_UNENCRYPTED_LOGS_PER_TX, LogHash), @@ -175,9 +175,9 @@ export class PublicAccumulatedData { static fromFields(fields: Fr[] | FieldReader) { const reader = FieldReader.asReader(fields); return new this( - reader.readArray(MAX_NEW_NOTE_HASHES_PER_TX, NoteHash), - reader.readArray(MAX_NEW_NULLIFIERS_PER_TX, Nullifier), - reader.readFieldArray(MAX_NEW_L2_TO_L1_MSGS_PER_TX), + reader.readArray(MAX_NOTE_HASHES_PER_TX, NoteHash), + reader.readArray(MAX_NULLIFIERS_PER_TX, Nullifier), + reader.readFieldArray(MAX_L2_TO_L1_MSGS_PER_TX), reader.readArray(MAX_NOTE_ENCRYPTED_LOGS_PER_TX, LogHash), reader.readArray(MAX_ENCRYPTED_LOGS_PER_TX, LogHash), reader.readArray(MAX_UNENCRYPTED_LOGS_PER_TX, LogHash), @@ -198,9 +198,9 @@ export class PublicAccumulatedData { static empty() { return new this( - makeTuple(MAX_NEW_NOTE_HASHES_PER_TX, NoteHash.empty), - makeTuple(MAX_NEW_NULLIFIERS_PER_TX, Nullifier.empty), - makeTuple(MAX_NEW_L2_TO_L1_MSGS_PER_TX, Fr.zero), + makeTuple(MAX_NOTE_HASHES_PER_TX, NoteHash.empty), + makeTuple(MAX_NULLIFIERS_PER_TX, Nullifier.empty), + makeTuple(MAX_L2_TO_L1_MSGS_PER_TX, Fr.zero), makeTuple(MAX_NOTE_ENCRYPTED_LOGS_PER_TX, LogHash.empty), makeTuple(MAX_ENCRYPTED_LOGS_PER_TX, LogHash.empty), makeTuple(MAX_UNENCRYPTED_LOGS_PER_TX, LogHash.empty), diff --git a/yarn-project/circuits.js/src/structs/kernel/public_accumulated_data_builder.ts b/yarn-project/circuits.js/src/structs/kernel/public_accumulated_data_builder.ts index 764fe280429..52505461fef 100644 --- a/yarn-project/circuits.js/src/structs/kernel/public_accumulated_data_builder.ts +++ b/yarn-project/circuits.js/src/structs/kernel/public_accumulated_data_builder.ts @@ -3,10 +3,10 @@ import { Fr } from '@aztec/foundation/fields'; import { MAX_ENCRYPTED_LOGS_PER_TX, - MAX_NEW_L2_TO_L1_MSGS_PER_TX, - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX, @@ -26,9 +26,9 @@ import { PublicAccumulatedData } from './public_accumulated_data.js'; * */ export class PublicAccumulatedDataBuilder { - private newNoteHashes: NoteHash[] = []; - private newNullifiers: Nullifier[] = []; - private newL2ToL1Msgs: Fr[] = []; + private noteHashes: NoteHash[] = []; + private nullifiers: Nullifier[] = []; + private l2ToL1Msgs: Fr[] = []; private noteEncryptedLogsHashes: LogHash[] = []; private encryptedLogsHashes: LogHash[] = []; private unencryptedLogsHashes: LogHash[] = []; @@ -36,33 +36,33 @@ export class PublicAccumulatedDataBuilder { private publicCallStack: CallRequest[] = []; private gasUsed: Gas = Gas.empty(); - pushNewNoteHash(newNoteHash: NoteHash) { - this.newNoteHashes.push(newNoteHash); + pushNoteHash(newNoteHash: NoteHash) { + this.noteHashes.push(newNoteHash); return this; } - withNewNoteHashes(newNoteHashes: NoteHash[]) { - this.newNoteHashes = newNoteHashes; + withNoteHashes(noteHashes: NoteHash[]) { + this.noteHashes = noteHashes; return this; } - pushNewNullifier(newNullifier: Nullifier) { - this.newNullifiers.push(newNullifier); + pushNullifier(newNullifier: Nullifier) { + this.nullifiers.push(newNullifier); return this; } - withNewNullifiers(newNullifiers: Nullifier[]) { - this.newNullifiers = newNullifiers; + withNullifiers(nullifiers: Nullifier[]) { + this.nullifiers = nullifiers; return this; } - pushNewL2ToL1Msg(newL2ToL1Msg: Fr) { - this.newL2ToL1Msgs.push(newL2ToL1Msg); + pushL2ToL1Msg(newL2ToL1Msg: Fr) { + this.l2ToL1Msgs.push(newL2ToL1Msg); return this; } - withNewL2ToL1Msgs(newL2ToL1Msgs: Fr[]) { - this.newL2ToL1Msgs = newL2ToL1Msgs; + withL2ToL1Msgs(l2ToL1Msgs: Fr[]) { + this.l2ToL1Msgs = l2ToL1Msgs; return this; } @@ -123,9 +123,9 @@ export class PublicAccumulatedDataBuilder { build(): PublicAccumulatedData { return new PublicAccumulatedData( - padArrayEnd(this.newNoteHashes, NoteHash.empty(), MAX_NEW_NOTE_HASHES_PER_TX), - padArrayEnd(this.newNullifiers, Nullifier.empty(), MAX_NEW_NULLIFIERS_PER_TX), - padArrayEnd(this.newL2ToL1Msgs, Fr.ZERO, MAX_NEW_L2_TO_L1_MSGS_PER_TX), + padArrayEnd(this.noteHashes, NoteHash.empty(), MAX_NOTE_HASHES_PER_TX), + padArrayEnd(this.nullifiers, Nullifier.empty(), MAX_NULLIFIERS_PER_TX), + padArrayEnd(this.l2ToL1Msgs, Fr.ZERO, MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(this.noteEncryptedLogsHashes, LogHash.empty(), MAX_NOTE_ENCRYPTED_LOGS_PER_TX), padArrayEnd(this.encryptedLogsHashes, LogHash.empty(), MAX_ENCRYPTED_LOGS_PER_TX), padArrayEnd(this.unencryptedLogsHashes, LogHash.empty(), MAX_UNENCRYPTED_LOGS_PER_TX), @@ -141,9 +141,9 @@ export class PublicAccumulatedDataBuilder { static fromPublicAccumulatedData(publicAccumulatedData: PublicAccumulatedData): PublicAccumulatedDataBuilder { return new PublicAccumulatedDataBuilder() - .withNewNoteHashes(publicAccumulatedData.newNoteHashes) - .withNewNullifiers(publicAccumulatedData.newNullifiers) - .withNewL2ToL1Msgs(publicAccumulatedData.newL2ToL1Msgs) + .withNoteHashes(publicAccumulatedData.noteHashes) + .withNullifiers(publicAccumulatedData.nullifiers) + .withL2ToL1Msgs(publicAccumulatedData.l2ToL1Msgs) .withNoteEncryptedLogsHashes(publicAccumulatedData.noteEncryptedLogsHashes) .withEncryptedLogsHashes(publicAccumulatedData.encryptedLogsHashes) .withUnencryptedLogsHashes(publicAccumulatedData.unencryptedLogsHashes) diff --git a/yarn-project/circuits.js/src/structs/non_existent_read_request_hints.ts b/yarn-project/circuits.js/src/structs/non_existent_read_request_hints.ts index b30b04bb4cd..e6ee1f1249d 100644 --- a/yarn-project/circuits.js/src/structs/non_existent_read_request_hints.ts +++ b/yarn-project/circuits.js/src/structs/non_existent_read_request_hints.ts @@ -3,7 +3,7 @@ import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/s import { type IndexedTreeLeafPreimage } from '@aztec/foundation/trees'; import { - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX, NULLIFIER_TREE_HEIGHT, } from '../constants.gen.js'; @@ -101,7 +101,7 @@ export type NullifierNonExistentReadRequestHints = NonExistentReadRequestHints< typeof MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX, typeof NULLIFIER_TREE_HEIGHT, IndexedTreeLeafPreimage, - typeof MAX_NEW_NULLIFIERS_PER_TX, + typeof MAX_NULLIFIERS_PER_TX, Nullifier >; @@ -113,7 +113,7 @@ export function nullifierNonExistentReadRequestHintsFromBuffer( MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX, NULLIFIER_TREE_HEIGHT, NullifierLeafPreimage, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NULLIFIERS_PER_TX, Nullifier, ); } @@ -123,8 +123,8 @@ export class NullifierNonExistentReadRequestHintsBuilder { private readRequestIndex = 0; constructor( - sortedPendingNullifiers: Tuple, - sortedPendingNullifierIndexHints: Tuple, + sortedPendingNullifiers: Tuple, + sortedPendingNullifierIndexHints: Tuple, ) { this.hints = new NonExistentReadRequestHints( makeTuple(MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX, () => @@ -137,8 +137,8 @@ export class NullifierNonExistentReadRequestHintsBuilder { } static empty() { - const emptySortedPendingNullifiers = makeTuple(MAX_NEW_NULLIFIERS_PER_TX, Nullifier.empty); - const emptySortedPendingNullifierIndexHints = makeTuple(MAX_NEW_NULLIFIERS_PER_TX, () => 0); + const emptySortedPendingNullifiers = makeTuple(MAX_NULLIFIERS_PER_TX, Nullifier.empty); + const emptySortedPendingNullifierIndexHints = makeTuple(MAX_NULLIFIERS_PER_TX, () => 0); return new NullifierNonExistentReadRequestHintsBuilder( emptySortedPendingNullifiers, emptySortedPendingNullifierIndexHints, diff --git a/yarn-project/circuits.js/src/structs/private_circuit_public_inputs.ts b/yarn-project/circuits.js/src/structs/private_circuit_public_inputs.ts index b7776d1e6ee..e8acb0c239b 100644 --- a/yarn-project/circuits.js/src/structs/private_circuit_public_inputs.ts +++ b/yarn-project/circuits.js/src/structs/private_circuit_public_inputs.ts @@ -15,11 +15,11 @@ import { GeneratorIndex, MAX_ENCRYPTED_LOGS_PER_CALL, MAX_KEY_VALIDATION_REQUESTS_PER_CALL, - MAX_NEW_L2_TO_L1_MSGS_PER_CALL, - MAX_NEW_NOTE_HASHES_PER_CALL, - MAX_NEW_NULLIFIERS_PER_CALL, + MAX_L2_TO_L1_MSGS_PER_CALL, MAX_NOTE_ENCRYPTED_LOGS_PER_CALL, + MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, + MAX_NULLIFIERS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, @@ -86,11 +86,11 @@ export class PrivateCircuitPublicInputs { /** * New note hashes created by the corresponding function call. */ - public newNoteHashes: Tuple, + public noteHashes: Tuple, /** * New nullifiers created by the corresponding function call. */ - public newNullifiers: Tuple, + public nullifiers: Tuple, /** * Private call requests made within the current kernel iteration. */ @@ -106,7 +106,7 @@ export class PrivateCircuitPublicInputs { /** * New L2 to L1 messages created by the corresponding function call. */ - public newL2ToL1Msgs: Tuple, + public l2ToL1Msgs: Tuple, /** * The side effect counter at the start of this call. */ @@ -170,12 +170,12 @@ export class PrivateCircuitPublicInputs { reader.readArray(MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, ReadRequest), reader.readArray(MAX_NULLIFIER_READ_REQUESTS_PER_CALL, ReadRequest), reader.readArray(MAX_KEY_VALIDATION_REQUESTS_PER_CALL, KeyValidationRequestAndGenerator), - reader.readArray(MAX_NEW_NOTE_HASHES_PER_CALL, NoteHash), - reader.readArray(MAX_NEW_NULLIFIERS_PER_CALL, Nullifier), + reader.readArray(MAX_NOTE_HASHES_PER_CALL, NoteHash), + reader.readArray(MAX_NULLIFIERS_PER_CALL, Nullifier), reader.readArray(MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, PrivateCallRequest), reader.readArray(MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, Fr), reader.readObject(Fr), - reader.readArray(MAX_NEW_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message), + reader.readArray(MAX_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message), reader.readObject(Fr), reader.readObject(Fr), reader.readArray(MAX_NOTE_ENCRYPTED_LOGS_PER_CALL, NoteLogHash), @@ -198,12 +198,12 @@ export class PrivateCircuitPublicInputs { reader.readArray(MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, ReadRequest), reader.readArray(MAX_NULLIFIER_READ_REQUESTS_PER_CALL, ReadRequest), reader.readArray(MAX_KEY_VALIDATION_REQUESTS_PER_CALL, KeyValidationRequestAndGenerator), - reader.readArray(MAX_NEW_NOTE_HASHES_PER_CALL, NoteHash), - reader.readArray(MAX_NEW_NULLIFIERS_PER_CALL, Nullifier), + reader.readArray(MAX_NOTE_HASHES_PER_CALL, NoteHash), + reader.readArray(MAX_NULLIFIERS_PER_CALL, Nullifier), reader.readArray(MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, PrivateCallRequest), reader.readFieldArray(MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL), reader.readField(), - reader.readArray(MAX_NEW_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message), + reader.readArray(MAX_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message), reader.readField(), reader.readField(), reader.readArray(MAX_NOTE_ENCRYPTED_LOGS_PER_CALL, NoteLogHash), @@ -229,12 +229,12 @@ export class PrivateCircuitPublicInputs { makeTuple(MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, ReadRequest.empty), makeTuple(MAX_NULLIFIER_READ_REQUESTS_PER_CALL, ReadRequest.empty), makeTuple(MAX_KEY_VALIDATION_REQUESTS_PER_CALL, KeyValidationRequestAndGenerator.empty), - makeTuple(MAX_NEW_NOTE_HASHES_PER_CALL, NoteHash.empty), - makeTuple(MAX_NEW_NULLIFIERS_PER_CALL, Nullifier.empty), + makeTuple(MAX_NOTE_HASHES_PER_CALL, NoteHash.empty), + makeTuple(MAX_NULLIFIERS_PER_CALL, Nullifier.empty), makeTuple(MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, PrivateCallRequest.empty), makeTuple(MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, Fr.zero), Fr.ZERO, - makeTuple(MAX_NEW_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message.empty), + makeTuple(MAX_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message.empty), Fr.ZERO, Fr.ZERO, makeTuple(MAX_NOTE_ENCRYPTED_LOGS_PER_CALL, NoteLogHash.empty), @@ -257,12 +257,12 @@ export class PrivateCircuitPublicInputs { isEmptyArray(this.noteHashReadRequests) && isEmptyArray(this.nullifierReadRequests) && isEmptyArray(this.keyValidationRequestsAndGenerators) && - isEmptyArray(this.newNoteHashes) && - isEmptyArray(this.newNullifiers) && + isEmptyArray(this.noteHashes) && + isEmptyArray(this.nullifiers) && isEmptyArray(this.privateCallRequests) && isZeroArray(this.publicCallStackHashes) && this.publicTeardownFunctionHash.isZero() && - isEmptyArray(this.newL2ToL1Msgs) && + isEmptyArray(this.l2ToL1Msgs) && isEmptyArray(this.noteEncryptedLogsHashes) && isEmptyArray(this.encryptedLogsHashes) && isEmptyArray(this.unencryptedLogsHashes) && @@ -287,12 +287,12 @@ export class PrivateCircuitPublicInputs { fields.noteHashReadRequests, fields.nullifierReadRequests, fields.keyValidationRequestsAndGenerators, - fields.newNoteHashes, - fields.newNullifiers, + fields.noteHashes, + fields.nullifiers, fields.privateCallRequests, fields.publicCallStackHashes, fields.publicTeardownFunctionHash, - fields.newL2ToL1Msgs, + fields.l2ToL1Msgs, fields.startSideEffectCounter, fields.endSideEffectCounter, fields.noteEncryptedLogsHashes, diff --git a/yarn-project/circuits.js/src/structs/public_call_stack_item.test.ts b/yarn-project/circuits.js/src/structs/public_call_stack_item.test.ts index 354986b7842..2ffbbcf8a4e 100644 --- a/yarn-project/circuits.js/src/structs/public_call_stack_item.test.ts +++ b/yarn-project/circuits.js/src/structs/public_call_stack_item.test.ts @@ -34,7 +34,7 @@ describe('PublicCallStackItem', () => { callStack.contractAddress = AztecAddress.fromField(new Fr(1)); callStack.functionData = new FunctionData(new FunctionSelector(2), /*isPrivate=*/ false); callStack.isExecutionRequest = true; - callStack.publicInputs.newNoteHashes[0] = new NoteHash(new Fr(1), 0); + callStack.publicInputs.noteHashes[0] = new NoteHash(new Fr(1), 0); const hash = callStack.hash(); expect(hash.toString()).toMatchSnapshot(); @@ -52,7 +52,7 @@ describe('PublicCallStackItem', () => { callStack.contractAddress = AztecAddress.fromField(new Fr(1)); callStack.functionData = new FunctionData(new FunctionSelector(2), /*isPrivate=*/ false); - callStack.publicInputs.newNoteHashes[0] = new NoteHash(new Fr(1), 0); + callStack.publicInputs.noteHashes[0] = new NoteHash(new Fr(1), 0); const hash = callStack.hash(); expect(hash.toString()).toMatchSnapshot(); diff --git a/yarn-project/circuits.js/src/structs/public_circuit_public_inputs.ts b/yarn-project/circuits.js/src/structs/public_circuit_public_inputs.ts index 28ad816def0..efffffd6547 100644 --- a/yarn-project/circuits.js/src/structs/public_circuit_public_inputs.ts +++ b/yarn-project/circuits.js/src/structs/public_circuit_public_inputs.ts @@ -15,10 +15,10 @@ import { type FieldsOf } from '@aztec/foundation/types'; import { GeneratorIndex, MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL, - MAX_NEW_L2_TO_L1_MSGS_PER_CALL, - MAX_NEW_NOTE_HASHES_PER_CALL, - MAX_NEW_NULLIFIERS_PER_CALL, + MAX_L2_TO_L1_MSGS_PER_CALL, + MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, + MAX_NULLIFIERS_PER_CALL, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, @@ -95,15 +95,15 @@ export class PublicCircuitPublicInputs { /** * New note hashes created within a public execution call */ - public newNoteHashes: Tuple, + public noteHashes: Tuple, /** * New nullifiers created within a public execution call */ - public newNullifiers: Tuple, + public nullifiers: Tuple, /** * New L2 to L1 messages generated during the call. */ - public newL2ToL1Msgs: Tuple, + public l2ToL1Msgs: Tuple, /** * The side effect counter when this context was started. */ @@ -169,9 +169,9 @@ export class PublicCircuitPublicInputs { makeTuple(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL, ContractStorageUpdateRequest.empty), makeTuple(MAX_PUBLIC_DATA_READS_PER_CALL, ContractStorageRead.empty), makeTuple(MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, Fr.zero), - makeTuple(MAX_NEW_NOTE_HASHES_PER_CALL, NoteHash.empty), - makeTuple(MAX_NEW_NULLIFIERS_PER_CALL, Nullifier.empty), - makeTuple(MAX_NEW_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message.empty), + makeTuple(MAX_NOTE_HASHES_PER_CALL, NoteHash.empty), + makeTuple(MAX_NULLIFIERS_PER_CALL, Nullifier.empty), + makeTuple(MAX_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message.empty), Fr.ZERO, Fr.ZERO, makeTuple(MAX_UNENCRYPTED_LOGS_PER_CALL, LogHash.empty), @@ -197,9 +197,9 @@ export class PublicCircuitPublicInputs { isEmptyArray(this.contractStorageUpdateRequests) && isEmptyArray(this.contractStorageReads) && isFrArrayEmpty(this.publicCallStackHashes) && - isEmptyArray(this.newNoteHashes) && - isEmptyArray(this.newNullifiers) && - isEmptyArray(this.newL2ToL1Msgs) && + isEmptyArray(this.noteHashes) && + isEmptyArray(this.nullifiers) && + isEmptyArray(this.l2ToL1Msgs) && this.startSideEffectCounter.isZero() && this.endSideEffectCounter.isZero() && isEmptyArray(this.unencryptedLogsHashes) && @@ -230,9 +230,9 @@ export class PublicCircuitPublicInputs { fields.contractStorageUpdateRequests, fields.contractStorageReads, fields.publicCallStackHashes, - fields.newNoteHashes, - fields.newNullifiers, - fields.newL2ToL1Msgs, + fields.noteHashes, + fields.nullifiers, + fields.l2ToL1Msgs, fields.startSideEffectCounter, fields.endSideEffectCounter, fields.unencryptedLogsHashes, @@ -282,9 +282,9 @@ export class PublicCircuitPublicInputs { reader.readArray(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL, ContractStorageUpdateRequest), reader.readArray(MAX_PUBLIC_DATA_READS_PER_CALL, ContractStorageRead), reader.readArray(MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, Fr), - reader.readArray(MAX_NEW_NOTE_HASHES_PER_CALL, NoteHash), - reader.readArray(MAX_NEW_NULLIFIERS_PER_CALL, Nullifier), - reader.readArray(MAX_NEW_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message), + reader.readArray(MAX_NOTE_HASHES_PER_CALL, NoteHash), + reader.readArray(MAX_NULLIFIERS_PER_CALL, Nullifier), + reader.readArray(MAX_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message), reader.readObject(Fr), reader.readObject(Fr), reader.readArray(MAX_UNENCRYPTED_LOGS_PER_CALL, LogHash), @@ -312,9 +312,9 @@ export class PublicCircuitPublicInputs { reader.readArray(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL, ContractStorageUpdateRequest), reader.readArray(MAX_PUBLIC_DATA_READS_PER_CALL, ContractStorageRead), reader.readFieldArray(MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL), - reader.readArray(MAX_NEW_NOTE_HASHES_PER_CALL, NoteHash), - reader.readArray(MAX_NEW_NULLIFIERS_PER_CALL, Nullifier), - reader.readArray(MAX_NEW_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message), + reader.readArray(MAX_NOTE_HASHES_PER_CALL, NoteHash), + reader.readArray(MAX_NULLIFIERS_PER_CALL, Nullifier), + reader.readArray(MAX_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message), reader.readField(), reader.readField(), reader.readArray(MAX_UNENCRYPTED_LOGS_PER_CALL, LogHash), diff --git a/yarn-project/circuits.js/src/structs/rollup/state_diff_hints.ts b/yarn-project/circuits.js/src/structs/rollup/state_diff_hints.ts index 5ff06e422c0..288f5c5d85b 100644 --- a/yarn-project/circuits.js/src/structs/rollup/state_diff_hints.ts +++ b/yarn-project/circuits.js/src/structs/rollup/state_diff_hints.ts @@ -4,7 +4,7 @@ import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/s import { type FieldsOf } from '@aztec/foundation/types'; import { - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NULLIFIERS_PER_TX, NOTE_HASH_SUBTREE_SIBLING_PATH_LENGTH, NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, NULLIFIER_TREE_HEIGHT, @@ -22,23 +22,23 @@ export class StateDiffHints { * The nullifiers which need to be updated to perform the batch insertion of the new nullifiers. * See `StandardIndexedTree.batchInsert` function for more details. */ - public nullifierPredecessorPreimages: Tuple, + public nullifierPredecessorPreimages: Tuple, /** * Membership witnesses for the nullifiers which need to be updated to perform the batch insertion of the new * nullifiers. */ public nullifierPredecessorMembershipWitnesses: Tuple< MembershipWitness, - typeof MAX_NEW_NULLIFIERS_PER_TX + typeof MAX_NULLIFIERS_PER_TX >, /** * The nullifiers to be inserted in the tree, sorted high to low. */ - public sortedNullifiers: Tuple, + public sortedNullifiers: Tuple, /** * The indexes of the sorted nullifiers to the original ones. */ - public sortedNullifierIndexes: Tuple, + public sortedNullifierIndexes: Tuple, /** * Sibling path "pointing to" where the new note hash subtree should be inserted into the note hash tree. */ @@ -85,12 +85,12 @@ export class StateDiffHints { static fromBuffer(buffer: Buffer | BufferReader): StateDiffHints { const reader = BufferReader.asReader(buffer); return new StateDiffHints( - reader.readArray(MAX_NEW_NULLIFIERS_PER_TX, NullifierLeafPreimage), - reader.readArray(MAX_NEW_NULLIFIERS_PER_TX, { + reader.readArray(MAX_NULLIFIERS_PER_TX, NullifierLeafPreimage), + reader.readArray(MAX_NULLIFIERS_PER_TX, { fromBuffer: buffer => MembershipWitness.fromBuffer(buffer, NULLIFIER_TREE_HEIGHT), }), - reader.readArray(MAX_NEW_NULLIFIERS_PER_TX, Fr), - reader.readNumbers(MAX_NEW_NULLIFIERS_PER_TX), + reader.readArray(MAX_NULLIFIERS_PER_TX, Fr), + reader.readNumbers(MAX_NULLIFIERS_PER_TX), reader.readArray(NOTE_HASH_SUBTREE_SIBLING_PATH_LENGTH, Fr), reader.readArray(NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, Fr), reader.readArray(PUBLIC_DATA_SUBTREE_SIBLING_PATH_LENGTH, Fr), @@ -99,10 +99,10 @@ export class StateDiffHints { static empty() { return new StateDiffHints( - makeTuple(MAX_NEW_NULLIFIERS_PER_TX, NullifierLeafPreimage.empty), - makeTuple(MAX_NEW_NULLIFIERS_PER_TX, () => MembershipWitness.empty(NULLIFIER_TREE_HEIGHT)), - makeTuple(MAX_NEW_NULLIFIERS_PER_TX, Fr.zero), - makeTuple(MAX_NEW_NULLIFIERS_PER_TX, () => 0), + makeTuple(MAX_NULLIFIERS_PER_TX, NullifierLeafPreimage.empty), + makeTuple(MAX_NULLIFIERS_PER_TX, () => MembershipWitness.empty(NULLIFIER_TREE_HEIGHT)), + makeTuple(MAX_NULLIFIERS_PER_TX, Fr.zero), + makeTuple(MAX_NULLIFIERS_PER_TX, () => 0), makeTuple(NOTE_HASH_SUBTREE_SIBLING_PATH_LENGTH, Fr.zero), makeTuple(NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, Fr.zero), makeTuple(PUBLIC_DATA_SUBTREE_SIBLING_PATH_LENGTH, Fr.zero), diff --git a/yarn-project/circuits.js/src/tests/factories.ts b/yarn-project/circuits.js/src/tests/factories.ts index 77956df0f35..f380c432041 100644 --- a/yarn-project/circuits.js/src/tests/factories.ts +++ b/yarn-project/circuits.js/src/tests/factories.ts @@ -49,16 +49,16 @@ import { MAX_KEY_VALIDATION_REQUESTS_PER_CALL, MAX_KEY_VALIDATION_REQUESTS_PER_TX, MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL, - MAX_NEW_L2_TO_L1_MSGS_PER_CALL, - MAX_NEW_L2_TO_L1_MSGS_PER_TX, - MAX_NEW_NOTE_HASHES_PER_CALL, - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_CALL, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_L2_TO_L1_MSGS_PER_CALL, + MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_CALL, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, + MAX_NOTE_HASHES_PER_CALL, + MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, + MAX_NULLIFIERS_PER_CALL, + MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, @@ -332,9 +332,9 @@ export function makeCombinedAccumulatedData(seed = 1, full = false): CombinedAcc const tupleGenerator = full ? makeTuple : makeHalfFullTuple; return new CombinedAccumulatedData( - tupleGenerator(MAX_NEW_NOTE_HASHES_PER_TX, fr, seed + 0x120, Fr.zero), - tupleGenerator(MAX_NEW_NULLIFIERS_PER_TX, fr, seed + 0x200, Fr.zero), - tupleGenerator(MAX_NEW_L2_TO_L1_MSGS_PER_TX, fr, seed + 0x600, Fr.zero), + tupleGenerator(MAX_NOTE_HASHES_PER_TX, fr, seed + 0x120, Fr.zero), + tupleGenerator(MAX_NULLIFIERS_PER_TX, fr, seed + 0x200, Fr.zero), + tupleGenerator(MAX_L2_TO_L1_MSGS_PER_TX, fr, seed + 0x600, Fr.zero), fr(seed + 0x700), // note encrypted logs hash fr(seed + 0x800), // encrypted logs hash fr(seed + 0x900), // unencrypted logs hash @@ -364,9 +364,9 @@ export function makePublicAccumulatedData(seed = 1, full = false): PublicAccumul const tupleGenerator = full ? makeTuple : makeHalfFullTuple; return new PublicAccumulatedData( - tupleGenerator(MAX_NEW_NOTE_HASHES_PER_TX, makeNoteHash, seed + 0x120, NoteHash.empty), - tupleGenerator(MAX_NEW_NULLIFIERS_PER_TX, makeNullifier, seed + 0x200, Nullifier.empty), - tupleGenerator(MAX_NEW_L2_TO_L1_MSGS_PER_TX, fr, seed + 0x600, Fr.zero), + tupleGenerator(MAX_NOTE_HASHES_PER_TX, makeNoteHash, seed + 0x120, NoteHash.empty), + tupleGenerator(MAX_NULLIFIERS_PER_TX, makeNullifier, seed + 0x200, Nullifier.empty), + tupleGenerator(MAX_L2_TO_L1_MSGS_PER_TX, fr, seed + 0x600, Fr.zero), tupleGenerator(MAX_NOTE_ENCRYPTED_LOGS_PER_TX, makeLogHash, seed + 0x700, LogHash.empty), // note encrypted logs hashes tupleGenerator(MAX_ENCRYPTED_LOGS_PER_TX, makeLogHash, seed + 0x800, LogHash.empty), // encrypted logs hashes tupleGenerator(MAX_UNENCRYPTED_LOGS_PER_TX, makeLogHash, seed + 0x900, LogHash.empty), // unencrypted logs hashes @@ -428,9 +428,9 @@ export function makePublicCircuitPublicInputs( ), tupleGenerator(MAX_PUBLIC_DATA_READS_PER_CALL, makeContractStorageRead, seed + 0x500, ContractStorageRead.empty), tupleGenerator(MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, fr, seed + 0x600, Fr.zero), - tupleGenerator(MAX_NEW_NOTE_HASHES_PER_CALL, makeNoteHash, seed + 0x700, NoteHash.empty), - tupleGenerator(MAX_NEW_NULLIFIERS_PER_CALL, makeNullifier, seed + 0x800, Nullifier.empty), - tupleGenerator(MAX_NEW_L2_TO_L1_MSGS_PER_CALL, makeL2ToL1Message, seed + 0x900, L2ToL1Message.empty), + tupleGenerator(MAX_NOTE_HASHES_PER_CALL, makeNoteHash, seed + 0x700, NoteHash.empty), + tupleGenerator(MAX_NULLIFIERS_PER_CALL, makeNullifier, seed + 0x800, Nullifier.empty), + tupleGenerator(MAX_L2_TO_L1_MSGS_PER_CALL, makeL2ToL1Message, seed + 0x900, L2ToL1Message.empty), fr(seed + 0xa00), fr(seed + 0xa01), tupleGenerator(MAX_UNENCRYPTED_LOGS_PER_CALL, makeLogHash, seed + 0x901, LogHash.empty), @@ -682,8 +682,8 @@ export function makePublicKernelCircuitPrivateInputs(seed = 1): PublicKernelCirc export function makeCombineHints(seed = 1): CombineHints { return CombineHints.from({ - sortedNoteHashes: makeTuple(MAX_NEW_NOTE_HASHES_PER_TX, makeNoteHash, seed + 0x100), - sortedNoteHashesIndexes: makeTuple(MAX_NEW_NOTE_HASHES_PER_TX, i => i, seed + 0x200), + sortedNoteHashes: makeTuple(MAX_NOTE_HASHES_PER_TX, makeNoteHash, seed + 0x100), + sortedNoteHashesIndexes: makeTuple(MAX_NOTE_HASHES_PER_TX, i => i, seed + 0x200), sortedUnencryptedLogsHashes: makeTuple(MAX_UNENCRYPTED_LOGS_PER_TX, makeLogHash, seed + 0x300), sortedUnencryptedLogsHashesIndexes: makeTuple(MAX_UNENCRYPTED_LOGS_PER_TX, i => i, seed + 0x400), sortedPublicDataUpdateRequests: makeTuple( @@ -793,12 +793,12 @@ export function makePrivateCircuitPublicInputs(seed = 0): PrivateCircuitPublicIn makeKeyValidationRequestAndGenerators, seed + 0x320, ), - newNoteHashes: makeTuple(MAX_NEW_NOTE_HASHES_PER_CALL, makeNoteHash, seed + 0x400), - newNullifiers: makeTuple(MAX_NEW_NULLIFIERS_PER_CALL, makeNullifier, seed + 0x500), + noteHashes: makeTuple(MAX_NOTE_HASHES_PER_CALL, makeNoteHash, seed + 0x400), + nullifiers: makeTuple(MAX_NULLIFIERS_PER_CALL, makeNullifier, seed + 0x500), privateCallRequests: makeTuple(MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, makePrivateCallRequest, seed + 0x600), publicCallStackHashes: makeTuple(MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, fr, seed + 0x700), publicTeardownFunctionHash: fr(seed + 0x800), - newL2ToL1Msgs: makeTuple(MAX_NEW_L2_TO_L1_MSGS_PER_CALL, makeL2ToL1Message, seed + 0x800), + l2ToL1Msgs: makeTuple(MAX_L2_TO_L1_MSGS_PER_CALL, makeL2ToL1Message, seed + 0x800), startSideEffectCounter: fr(seed + 0x849), endSideEffectCounter: fr(seed + 0x850), noteEncryptedLogsHashes: makeTuple(MAX_NOTE_ENCRYPTED_LOGS_PER_CALL, makeNoteLogHash, seed + 0x875), @@ -1111,20 +1111,20 @@ export function makePublicDataTreeLeafPreimage(seed = 0): PublicDataTreeLeafPrei */ export function makeStateDiffHints(seed = 1): StateDiffHints { const nullifierPredecessorPreimages = makeTuple( - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NULLIFIERS_PER_TX, x => new NullifierLeafPreimage(fr(x), fr(x + 0x100), BigInt(x + 0x200)), seed + 0x1000, ); const nullifierPredecessorMembershipWitnesses = makeTuple( - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NULLIFIERS_PER_TX, x => makeMembershipWitness(NULLIFIER_TREE_HEIGHT, x), seed + 0x2000, ); - const sortedNullifiers = makeTuple(MAX_NEW_NULLIFIERS_PER_TX, fr, seed + 0x3000); + const sortedNullifiers = makeTuple(MAX_NULLIFIERS_PER_TX, fr, seed + 0x3000); - const sortedNullifierIndexes = makeTuple(MAX_NEW_NULLIFIERS_PER_TX, i => i, seed + 0x4000); + const sortedNullifierIndexes = makeTuple(MAX_NULLIFIERS_PER_TX, i => i, seed + 0x4000); const noteHashSubtreeSiblingPath = makeTuple(NOTE_HASH_SUBTREE_SIBLING_PATH_LENGTH, fr, seed + 0x5000); diff --git a/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts b/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts index af92189500d..628bfaf8db3 100644 --- a/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts +++ b/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts @@ -22,9 +22,9 @@ import { GasFees, type Header, KernelCircuitPublicInputs, - MAX_NEW_L2_TO_L1_MSGS_PER_TX, - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_L2_TO_L1_MSGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, type Proof, @@ -183,10 +183,10 @@ describe('L1Publisher integration', () => { const processedTx = makeProcessedTx(tx, kernelOutput, makeProof(), []); - processedTx.data.end.newNoteHashes = makeTuple(MAX_NEW_NOTE_HASHES_PER_TX, fr, seed + 0x100); - processedTx.data.end.newNullifiers = makeTuple(MAX_NEW_NULLIFIERS_PER_TX, fr, seed + 0x200); - processedTx.data.end.newNullifiers[processedTx.data.end.newNullifiers.length - 1] = Fr.ZERO; - processedTx.data.end.newL2ToL1Msgs = makeTuple(MAX_NEW_L2_TO_L1_MSGS_PER_TX, fr, seed + 0x300); + processedTx.data.end.noteHashes = makeTuple(MAX_NOTE_HASHES_PER_TX, fr, seed + 0x100); + processedTx.data.end.nullifiers = makeTuple(MAX_NULLIFIERS_PER_TX, fr, seed + 0x200); + processedTx.data.end.nullifiers[processedTx.data.end.nullifiers.length - 1] = Fr.ZERO; + processedTx.data.end.l2ToL1Msgs = makeTuple(MAX_L2_TO_L1_MSGS_PER_TX, fr, seed + 0x300); processedTx.data.end.encryptedLogsHash = Fr.fromBuffer(processedTx.encryptedLogs.hash()); processedTx.data.end.unencryptedLogsHash = Fr.fromBuffer(processedTx.unencryptedLogs.hash()); @@ -370,12 +370,12 @@ describe('L1Publisher integration', () => { } // Ensure that each transaction has unique (non-intersecting nullifier values) - const totalNullifiersPerBlock = 4 * MAX_NEW_NULLIFIERS_PER_TX; + const totalNullifiersPerBlock = 4 * MAX_NULLIFIERS_PER_TX; const txs = [ - makeBloatedProcessedTx(totalNullifiersPerBlock * i + 1 * MAX_NEW_NULLIFIERS_PER_TX), - makeBloatedProcessedTx(totalNullifiersPerBlock * i + 2 * MAX_NEW_NULLIFIERS_PER_TX), - makeBloatedProcessedTx(totalNullifiersPerBlock * i + 3 * MAX_NEW_NULLIFIERS_PER_TX), - makeBloatedProcessedTx(totalNullifiersPerBlock * i + 4 * MAX_NEW_NULLIFIERS_PER_TX), + makeBloatedProcessedTx(totalNullifiersPerBlock * i + 1 * MAX_NULLIFIERS_PER_TX), + makeBloatedProcessedTx(totalNullifiersPerBlock * i + 2 * MAX_NULLIFIERS_PER_TX), + makeBloatedProcessedTx(totalNullifiersPerBlock * i + 3 * MAX_NULLIFIERS_PER_TX), + makeBloatedProcessedTx(totalNullifiersPerBlock * i + 4 * MAX_NULLIFIERS_PER_TX), ]; const globalVariables = new GlobalVariables( @@ -396,7 +396,7 @@ describe('L1Publisher integration', () => { blockSource.getL1ToL2Messages.mockResolvedValueOnce(currentL1ToL2Messages); blockSource.getBlocks.mockResolvedValueOnce([block]); - const newL2ToL1MsgsArray = block.body.txEffects.flatMap(txEffect => txEffect.l2ToL1Msgs); + const l2ToL1MsgsArray = block.body.txEffects.flatMap(txEffect => txEffect.l2ToL1Msgs); const [emptyRoot] = await outbox.read.roots([block.header.globalVariables.blockNumber.toBigInt()]); @@ -439,7 +439,7 @@ describe('L1Publisher integration', () => { expect(newToConsume).toEqual(toConsume + 1n); toConsume = newToConsume; - const treeHeight = Math.ceil(Math.log2(newL2ToL1MsgsArray.length)); + const treeHeight = Math.ceil(Math.log2(l2ToL1MsgsArray.length)); const tree = new StandardTree( openTmpStore(true), @@ -449,7 +449,7 @@ describe('L1Publisher integration', () => { 0n, Fr, ); - await tree.appendLeaves(newL2ToL1MsgsArray); + await tree.appendLeaves(l2ToL1MsgsArray); const expectedRoot = tree.getRoot(true); const [actualRoot] = await outbox.read.roots([block.header.globalVariables.blockNumber.toBigInt()]); diff --git a/yarn-project/end-to-end/src/e2e_pending_note_hashes_contract.test.ts b/yarn-project/end-to-end/src/e2e_pending_note_hashes_contract.test.ts index 46df722fee2..6e24dddfd32 100644 --- a/yarn-project/end-to-end/src/e2e_pending_note_hashes_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_pending_note_hashes_contract.test.ts @@ -1,7 +1,7 @@ import { type AztecAddress, type AztecNode, type DebugLogger, Fr, type Wallet } from '@aztec/aztec.js'; import { - MAX_NEW_NOTE_HASHES_PER_CALL, - MAX_NEW_NOTE_HASHES_PER_TX, + MAX_NOTE_HASHES_PER_CALL, + MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, } from '@aztec/circuits.js'; @@ -290,8 +290,8 @@ describe('e2e_pending_note_hashes_contract', () => { it('Should handle overflowing the kernel data structures in nested calls', async () => { // Setting the outgoing viewer to owner not have to bother with setting up another account. const outgoingViewer = owner; - const notesPerIteration = Math.min(MAX_NEW_NOTE_HASHES_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL); - const minToNeedReset = Math.min(MAX_NEW_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX) + 1; + const notesPerIteration = Math.min(MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL); + const minToNeedReset = Math.min(MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX) + 1; const deployedContract = await deployContract(); await deployedContract.methods .test_recursively_create_notes(owner, outgoingViewer, Math.ceil(minToNeedReset / notesPerIteration)) diff --git a/yarn-project/noir-protocol-circuits-types/src/type_conversion.ts b/yarn-project/noir-protocol-circuits-types/src/type_conversion.ts index 3cfd493bbe8..1db7ea73636 100644 --- a/yarn-project/noir-protocol-circuits-types/src/type_conversion.ts +++ b/yarn-project/noir-protocol-circuits-types/src/type_conversion.ts @@ -37,11 +37,11 @@ import { LogHash, MAX_ENCRYPTED_LOGS_PER_TX, MAX_KEY_VALIDATION_REQUESTS_PER_TX, - MAX_NEW_L2_TO_L1_MSGS_PER_TX, - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX, @@ -937,12 +937,12 @@ export function mapPrivateCircuitPublicInputsToNoir( privateCircuitPublicInputs.keyValidationRequestsAndGenerators, mapKeyValidationRequestAndGeneratorToNoir, ), - new_note_hashes: mapTuple(privateCircuitPublicInputs.newNoteHashes, mapNoteHashToNoir), - new_nullifiers: mapTuple(privateCircuitPublicInputs.newNullifiers, mapNullifierToNoir), + note_hashes: mapTuple(privateCircuitPublicInputs.noteHashes, mapNoteHashToNoir), + nullifiers: mapTuple(privateCircuitPublicInputs.nullifiers, mapNullifierToNoir), private_call_requests: mapTuple(privateCircuitPublicInputs.privateCallRequests, mapPrivateCallRequestToNoir), public_call_stack_hashes: mapTuple(privateCircuitPublicInputs.publicCallStackHashes, mapFieldToNoir), public_teardown_function_hash: mapFieldToNoir(privateCircuitPublicInputs.publicTeardownFunctionHash), - new_l2_to_l1_msgs: mapTuple(privateCircuitPublicInputs.newL2ToL1Msgs, mapL2ToL1MessageToNoir), + l2_to_l1_msgs: mapTuple(privateCircuitPublicInputs.l2ToL1Msgs, mapL2ToL1MessageToNoir), start_side_effect_counter: mapFieldToNoir(privateCircuitPublicInputs.startSideEffectCounter), end_side_effect_counter: mapFieldToNoir(privateCircuitPublicInputs.endSideEffectCounter), note_encrypted_logs_hashes: mapTuple(privateCircuitPublicInputs.noteEncryptedLogsHashes, mapNoteLogHashToNoir), @@ -1244,13 +1244,9 @@ export function mapPrivateAccumulatedDataFromNoir( privateAccumulatedData: PrivateAccumulatedDataNoir, ): PrivateAccumulatedData { return new PrivateAccumulatedData( - mapTupleFromNoir(privateAccumulatedData.new_note_hashes, MAX_NEW_NOTE_HASHES_PER_TX, mapScopedNoteHashFromNoir), - mapTupleFromNoir(privateAccumulatedData.new_nullifiers, MAX_NEW_NULLIFIERS_PER_TX, mapScopedNullifierFromNoir), - mapTupleFromNoir( - privateAccumulatedData.new_l2_to_l1_msgs, - MAX_NEW_L2_TO_L1_MSGS_PER_TX, - mapScopedL2ToL1MessageFromNoir, - ), + mapTupleFromNoir(privateAccumulatedData.note_hashes, MAX_NOTE_HASHES_PER_TX, mapScopedNoteHashFromNoir), + mapTupleFromNoir(privateAccumulatedData.nullifiers, MAX_NULLIFIERS_PER_TX, mapScopedNullifierFromNoir), + mapTupleFromNoir(privateAccumulatedData.l2_to_l1_msgs, MAX_L2_TO_L1_MSGS_PER_TX, mapScopedL2ToL1MessageFromNoir), mapTupleFromNoir( privateAccumulatedData.note_encrypted_logs_hashes, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, @@ -1281,9 +1277,9 @@ export function mapPrivateAccumulatedDataFromNoir( export function mapPrivateAccumulatedDataToNoir(data: PrivateAccumulatedData): PrivateAccumulatedDataNoir { return { - new_note_hashes: mapTuple(data.newNoteHashes, mapScopedNoteHashToNoir), - new_nullifiers: mapTuple(data.newNullifiers, mapScopedNullifierToNoir), - new_l2_to_l1_msgs: mapTuple(data.newL2ToL1Msgs, mapScopedL2ToL1MessageToNoir), + note_hashes: mapTuple(data.noteHashes, mapScopedNoteHashToNoir), + nullifiers: mapTuple(data.nullifiers, mapScopedNullifierToNoir), + l2_to_l1_msgs: mapTuple(data.l2ToL1Msgs, mapScopedL2ToL1MessageToNoir), note_encrypted_logs_hashes: mapTuple(data.noteEncryptedLogsHashes, mapNoteLogHashToNoir), encrypted_logs_hashes: mapTuple(data.encryptedLogsHashes, mapScopedEncryptedLogHashToNoir), unencrypted_logs_hashes: mapTuple(data.unencryptedLogsHashes, mapScopedLogHashToNoir), @@ -1296,9 +1292,9 @@ export function mapPublicAccumulatedDataFromNoir( publicAccumulatedData: PublicAccumulatedDataNoir, ): PublicAccumulatedData { return new PublicAccumulatedData( - mapTupleFromNoir(publicAccumulatedData.new_note_hashes, MAX_NEW_NOTE_HASHES_PER_TX, mapNoteHashFromNoir), - mapTupleFromNoir(publicAccumulatedData.new_nullifiers, MAX_NEW_NULLIFIERS_PER_TX, mapNullifierFromNoir), - mapTupleFromNoir(publicAccumulatedData.new_l2_to_l1_msgs, MAX_NEW_L2_TO_L1_MSGS_PER_TX, mapFieldFromNoir), + mapTupleFromNoir(publicAccumulatedData.note_hashes, MAX_NOTE_HASHES_PER_TX, mapNoteHashFromNoir), + mapTupleFromNoir(publicAccumulatedData.nullifiers, MAX_NULLIFIERS_PER_TX, mapNullifierFromNoir), + mapTupleFromNoir(publicAccumulatedData.l2_to_l1_msgs, MAX_L2_TO_L1_MSGS_PER_TX, mapFieldFromNoir), mapTupleFromNoir( publicAccumulatedData.note_encrypted_logs_hashes, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, @@ -1324,9 +1320,9 @@ export function mapPublicAccumulatedDataToNoir( publicAccumulatedData: PublicAccumulatedData, ): PublicAccumulatedDataNoir { return { - new_note_hashes: mapTuple(publicAccumulatedData.newNoteHashes, mapNoteHashToNoir), - new_nullifiers: mapTuple(publicAccumulatedData.newNullifiers, mapNullifierToNoir), - new_l2_to_l1_msgs: mapTuple(publicAccumulatedData.newL2ToL1Msgs, mapFieldToNoir), + note_hashes: mapTuple(publicAccumulatedData.noteHashes, mapNoteHashToNoir), + nullifiers: mapTuple(publicAccumulatedData.nullifiers, mapNullifierToNoir), + l2_to_l1_msgs: mapTuple(publicAccumulatedData.l2ToL1Msgs, mapFieldToNoir), note_encrypted_logs_hashes: mapTuple(publicAccumulatedData.noteEncryptedLogsHashes, mapLogHashToNoir), encrypted_logs_hashes: mapTuple(publicAccumulatedData.encryptedLogsHashes, mapLogHashToNoir), unencrypted_logs_hashes: mapTuple(publicAccumulatedData.unencryptedLogsHashes, mapLogHashToNoir), @@ -1389,9 +1385,9 @@ export function mapCombinedAccumulatedDataFromNoir( combinedAccumulatedData: CombinedAccumulatedDataNoir, ): CombinedAccumulatedData { return new CombinedAccumulatedData( - mapTupleFromNoir(combinedAccumulatedData.new_note_hashes, MAX_NEW_NOTE_HASHES_PER_TX, mapFieldFromNoir), - mapTupleFromNoir(combinedAccumulatedData.new_nullifiers, MAX_NEW_NULLIFIERS_PER_TX, mapFieldFromNoir), - mapTupleFromNoir(combinedAccumulatedData.new_l2_to_l1_msgs, MAX_NEW_L2_TO_L1_MSGS_PER_TX, mapFieldFromNoir), + mapTupleFromNoir(combinedAccumulatedData.note_hashes, MAX_NOTE_HASHES_PER_TX, mapFieldFromNoir), + mapTupleFromNoir(combinedAccumulatedData.nullifiers, MAX_NULLIFIERS_PER_TX, mapFieldFromNoir), + mapTupleFromNoir(combinedAccumulatedData.l2_to_l1_msgs, MAX_L2_TO_L1_MSGS_PER_TX, mapFieldFromNoir), mapFieldFromNoir(combinedAccumulatedData.note_encrypted_logs_hash), mapFieldFromNoir(combinedAccumulatedData.encrypted_logs_hash), mapFieldFromNoir(combinedAccumulatedData.unencrypted_logs_hash), @@ -1411,9 +1407,9 @@ export function mapCombinedAccumulatedDataToNoir( combinedAccumulatedData: CombinedAccumulatedData, ): CombinedAccumulatedDataNoir { return { - new_note_hashes: mapTuple(combinedAccumulatedData.newNoteHashes, mapFieldToNoir), - new_nullifiers: mapTuple(combinedAccumulatedData.newNullifiers, mapFieldToNoir), - new_l2_to_l1_msgs: mapTuple(combinedAccumulatedData.newL2ToL1Msgs, mapFieldToNoir), + note_hashes: mapTuple(combinedAccumulatedData.noteHashes, mapFieldToNoir), + nullifiers: mapTuple(combinedAccumulatedData.nullifiers, mapFieldToNoir), + l2_to_l1_msgs: mapTuple(combinedAccumulatedData.l2ToL1Msgs, mapFieldToNoir), note_encrypted_logs_hash: mapFieldToNoir(combinedAccumulatedData.noteEncryptedLogsHash), encrypted_logs_hash: mapFieldToNoir(combinedAccumulatedData.encryptedLogsHash), unencrypted_logs_hash: mapFieldToNoir(combinedAccumulatedData.unencryptedLogsHash), @@ -1886,9 +1882,9 @@ export function mapPublicCircuitPublicInputsToNoir( ), contract_storage_reads: mapTuple(publicInputs.contractStorageReads, mapStorageReadToNoir), public_call_stack_hashes: mapTuple(publicInputs.publicCallStackHashes, mapFieldToNoir), - new_note_hashes: mapTuple(publicInputs.newNoteHashes, mapNoteHashToNoir), - new_nullifiers: mapTuple(publicInputs.newNullifiers, mapNullifierToNoir), - new_l2_to_l1_msgs: mapTuple(publicInputs.newL2ToL1Msgs, mapL2ToL1MessageToNoir), + note_hashes: mapTuple(publicInputs.noteHashes, mapNoteHashToNoir), + nullifiers: mapTuple(publicInputs.nullifiers, mapNullifierToNoir), + l2_to_l1_msgs: mapTuple(publicInputs.l2ToL1Msgs, mapL2ToL1MessageToNoir), start_side_effect_counter: mapFieldToNoir(publicInputs.startSideEffectCounter), end_side_effect_counter: mapFieldToNoir(publicInputs.endSideEffectCounter), unencrypted_logs_hashes: mapTuple(publicInputs.unencryptedLogsHashes, mapLogHashToNoir), @@ -2047,8 +2043,8 @@ export function mapRootRollupInputsToNoir(rootRollupInputs: RootRollupInputs): R return { previous_rollup_data: mapTuple(rootRollupInputs.previousRollupData, mapPreviousRollupDataToNoir), l1_to_l2_roots: mapRootRollupParityInputToNoir(rootRollupInputs.l1ToL2Roots), - new_l1_to_l2_messages: mapTuple(rootRollupInputs.newL1ToL2Messages, mapFieldToNoir), - new_l1_to_l2_message_tree_root_sibling_path: mapTuple( + l1_to_l2_messages: mapTuple(rootRollupInputs.newL1ToL2Messages, mapFieldToNoir), + l1_to_l2_message_subtree_sibling_path: mapTuple( rootRollupInputs.newL1ToL2MessageTreeRootSiblingPath, mapFieldToNoir, ), diff --git a/yarn-project/prover-client/src/mocks/fixtures.ts b/yarn-project/prover-client/src/mocks/fixtures.ts index 81a1aff8a14..09934382c59 100644 --- a/yarn-project/prover-client/src/mocks/fixtures.ts +++ b/yarn-project/prover-client/src/mocks/fixtures.ts @@ -12,9 +12,9 @@ import { GasFees, GlobalVariables, KernelCircuitPublicInputs, - MAX_NEW_L2_TO_L1_MSGS_PER_TX, - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_L2_TO_L1_MSGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, NULLIFIER_TREE_HEIGHT, PUBLIC_DATA_SUBTREE_HEIGHT, @@ -96,7 +96,7 @@ export async function getSimulationProvider( } export const makeBloatedProcessedTx = async (builderDb: MerkleTreeOperations, seed = 0x1) => { - seed *= MAX_NEW_NULLIFIERS_PER_TX; // Ensure no clashing given incremental seeds + seed *= MAX_NULLIFIERS_PER_TX; // Ensure no clashing given incremental seeds const tx = mockTx(seed); const kernelOutput = KernelCircuitPublicInputs.empty(); kernelOutput.constants.historicalHeader = await builderDb.buildInitialHeader(); @@ -113,12 +113,12 @@ export const makeBloatedProcessedTx = async (builderDb: MerkleTreeOperations, se const processedTx = makeProcessedTx(tx, kernelOutput, makeProof(), []); - processedTx.data.end.newNoteHashes = makeTuple(MAX_NEW_NOTE_HASHES_PER_TX, fr, seed + 0x100); - processedTx.data.end.newNullifiers = makeTuple(MAX_NEW_NULLIFIERS_PER_TX, fr, seed + 0x100000); + processedTx.data.end.noteHashes = makeTuple(MAX_NOTE_HASHES_PER_TX, fr, seed + 0x100); + processedTx.data.end.nullifiers = makeTuple(MAX_NULLIFIERS_PER_TX, fr, seed + 0x100000); - processedTx.data.end.newNullifiers[tx.data.forPublic!.end.newNullifiers.length - 1] = Fr.zero(); + processedTx.data.end.nullifiers[tx.data.forPublic!.end.nullifiers.length - 1] = Fr.zero(); - processedTx.data.end.newL2ToL1Msgs = makeTuple(MAX_NEW_L2_TO_L1_MSGS_PER_TX, fr, seed + 0x300); + processedTx.data.end.l2ToL1Msgs = makeTuple(MAX_L2_TO_L1_MSGS_PER_TX, fr, seed + 0x300); processedTx.data.end.noteEncryptedLogsHash = Fr.fromBuffer(processedTx.noteEncryptedLogs.hash()); processedTx.data.end.encryptedLogsHash = Fr.fromBuffer(processedTx.encryptedLogs.hash()); processedTx.data.end.unencryptedLogsHash = Fr.fromBuffer(processedTx.unencryptedLogs.hash()); @@ -137,9 +137,9 @@ export const updateExpectedTreesFromTxs = async (db: MerkleTreeOperations, txs: MerkleTreeId.NOTE_HASH_TREE, txs.flatMap(tx => padArrayEnd( - tx.data.end.newNoteHashes.filter(x => !x.isZero()), + tx.data.end.noteHashes.filter(x => !x.isZero()), Fr.zero(), - MAX_NEW_NOTE_HASHES_PER_TX, + MAX_NOTE_HASHES_PER_TX, ), ), ); @@ -147,9 +147,9 @@ export const updateExpectedTreesFromTxs = async (db: MerkleTreeOperations, txs: MerkleTreeId.NULLIFIER_TREE, txs.flatMap(tx => padArrayEnd( - tx.data.end.newNullifiers.filter(x => !x.isZero()), + tx.data.end.nullifiers.filter(x => !x.isZero()), Fr.zero(), - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NULLIFIERS_PER_TX, ).map(x => x.toBuffer()), ), NULLIFIER_TREE_HEIGHT, diff --git a/yarn-project/prover-client/src/orchestrator/block-building-helpers.ts b/yarn-project/prover-client/src/orchestrator/block-building-helpers.ts index c09ca0af388..64e68f7a271 100644 --- a/yarn-project/prover-client/src/orchestrator/block-building-helpers.ts +++ b/yarn-project/prover-client/src/orchestrator/block-building-helpers.ts @@ -9,7 +9,7 @@ import { type GlobalVariables, KernelData, type L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MembershipWitness, MergeRollupInputs, @@ -102,8 +102,8 @@ export async function buildBaseRollupInput( // Update the note hash trees with the new items being inserted to get the new roots // that will be used by the next iteration of the base rollup circuit, skipping the empty ones - const newNoteHashes = tx.data.end.newNoteHashes; - await db.appendLeaves(MerkleTreeId.NOTE_HASH_TREE, newNoteHashes); + const noteHashes = tx.data.end.noteHashes; + await db.appendLeaves(MerkleTreeId.NOTE_HASH_TREE, noteHashes); // The read witnesses for a given TX should be generated before the writes of the same TX are applied. // All reads that refer to writes in the same tx are transient and can be simplified out. @@ -112,12 +112,12 @@ export async function buildBaseRollupInput( // Update the nullifier tree, capturing the low nullifier info for each individual operation const { lowLeavesWitnessData: nullifierWitnessLeaves, - newSubtreeSiblingPath: newNullifiersSubtreeSiblingPath, - sortedNewLeaves: sortedNewNullifiers, + newSubtreeSiblingPath: nullifiersSubtreeSiblingPath, + sortedNewLeaves: sortednullifiers, sortedNewLeavesIndexes, } = await db.batchInsert( MerkleTreeId.NULLIFIER_TREE, - tx.data.end.newNullifiers.map(n => n.toBuffer()), + tx.data.end.nullifiers.map(n => n.toBuffer()), NULLIFIER_SUBTREE_HEIGHT, ); if (nullifierWitnessLeaves === undefined) { @@ -130,7 +130,7 @@ export async function buildBaseRollupInput( MembershipWitness.fromBufferArray(l.index, assertLength(l.siblingPath.toBufferArray(), NULLIFIER_TREE_HEIGHT)), ); - const nullifierSubtreeSiblingPathArray = newNullifiersSubtreeSiblingPath.toFields(); + const nullifierSubtreeSiblingPathArray = nullifiersSubtreeSiblingPath.toFields(); const nullifierSubtreeSiblingPath = makeTuple(NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, i => i < nullifierSubtreeSiblingPathArray.length ? nullifierSubtreeSiblingPathArray[i] : Fr.ZERO, @@ -139,18 +139,18 @@ export async function buildBaseRollupInput( const publicDataSiblingPath = txPublicDataUpdateRequestInfo.newPublicDataSubtreeSiblingPath; const stateDiffHints = StateDiffHints.from({ - nullifierPredecessorPreimages: makeTuple(MAX_NEW_NULLIFIERS_PER_TX, i => + nullifierPredecessorPreimages: makeTuple(MAX_NULLIFIERS_PER_TX, i => i < nullifierWitnessLeaves.length ? (nullifierWitnessLeaves[i].leafPreimage as NullifierLeafPreimage) : NullifierLeafPreimage.empty(), ), - nullifierPredecessorMembershipWitnesses: makeTuple(MAX_NEW_NULLIFIERS_PER_TX, i => + nullifierPredecessorMembershipWitnesses: makeTuple(MAX_NULLIFIERS_PER_TX, i => i < nullifierPredecessorMembershipWitnessesWithoutPadding.length ? nullifierPredecessorMembershipWitnessesWithoutPadding[i] : makeEmptyMembershipWitness(NULLIFIER_TREE_HEIGHT), ), - sortedNullifiers: makeTuple(MAX_NEW_NULLIFIERS_PER_TX, i => Fr.fromBuffer(sortedNewNullifiers[i])), - sortedNullifierIndexes: makeTuple(MAX_NEW_NULLIFIERS_PER_TX, i => sortedNewLeavesIndexes[i]), + sortedNullifiers: makeTuple(MAX_NULLIFIERS_PER_TX, i => Fr.fromBuffer(sortednullifiers[i])), + sortedNullifierIndexes: makeTuple(MAX_NULLIFIERS_PER_TX, i => sortedNewLeavesIndexes[i]), noteHashSubtreeSiblingPath, nullifierSubtreeSiblingPath, publicDataSiblingPath, diff --git a/yarn-project/pxe/src/database/deferred_note_dao.test.ts b/yarn-project/pxe/src/database/deferred_note_dao.test.ts index efe57f5a681..542774a1165 100644 --- a/yarn-project/pxe/src/database/deferred_note_dao.test.ts +++ b/yarn-project/pxe/src/database/deferred_note_dao.test.ts @@ -12,7 +12,7 @@ export const randomDeferredNoteDao = ({ txHash = randomTxHash(), storageSlot = Fr.random(), noteTypeId = NoteSelector.random(), - newNoteHashes = [Fr.random(), Fr.random()], + noteHashes = [Fr.random(), Fr.random()], dataStartIndexForTx = randomInt(100), }: Partial = {}) => { return new DeferredNoteDao( @@ -22,7 +22,7 @@ export const randomDeferredNoteDao = ({ storageSlot, noteTypeId, txHash, - newNoteHashes, + noteHashes, dataStartIndexForTx, ); }; diff --git a/yarn-project/pxe/src/database/deferred_note_dao.ts b/yarn-project/pxe/src/database/deferred_note_dao.ts index d1d0c551209..bc5cfd455ba 100644 --- a/yarn-project/pxe/src/database/deferred_note_dao.ts +++ b/yarn-project/pxe/src/database/deferred_note_dao.ts @@ -23,7 +23,7 @@ export class DeferredNoteDao { /** The hash of the tx the note was created in. Equal to the first nullifier */ public txHash: TxHash, /** New note hashes in this transaction, one of which belongs to this note */ - public newNoteHashes: Fr[], + public noteHashes: Fr[], /** The next available leaf index for the note hash tree for this transaction */ public dataStartIndexForTx: number, ) {} @@ -36,7 +36,7 @@ export class DeferredNoteDao { this.storageSlot, this.noteTypeId, this.txHash, - new Vector(this.newNoteHashes), + new Vector(this.noteHashes), this.dataStartIndexForTx, ); } diff --git a/yarn-project/pxe/src/kernel_prover/kernel_prover.test.ts b/yarn-project/pxe/src/kernel_prover/kernel_prover.test.ts index e60353cd405..2fce75e6581 100644 --- a/yarn-project/pxe/src/kernel_prover/kernel_prover.test.ts +++ b/yarn-project/pxe/src/kernel_prover/kernel_prover.test.ts @@ -2,8 +2,8 @@ import { Note, type ProofCreator } from '@aztec/circuit-types'; import { FunctionData, FunctionSelector, - MAX_NEW_NOTE_HASHES_PER_CALL, - MAX_NEW_NOTE_HASHES_PER_TX, + MAX_NOTE_HASHES_PER_CALL, + MAX_NOTE_HASHES_PER_TX, MembershipWitness, NESTED_RECURSIVE_PROOF_LENGTH, NoteHash, @@ -56,8 +56,8 @@ describe('Kernel Prover', () => { const createExecutionResult = (fnName: string, newNoteIndices: number[] = []): ExecutionResult => { const publicInputs = PrivateCircuitPublicInputs.empty(); - publicInputs.newNoteHashes = makeTuple( - MAX_NEW_NOTE_HASHES_PER_CALL, + publicInputs.noteHashes = makeTuple( + MAX_NOTE_HASHES_PER_CALL, i => i < newNoteIndices.length ? new NoteHash(generateFakeCommitment(notesAndSlots[newNoteIndices[i]]), 0) @@ -86,7 +86,7 @@ describe('Kernel Prover', () => { const createProofOutput = (newNoteIndices: number[]) => { const publicInputs = PrivateKernelCircuitPublicInputs.empty(); - const noteHashes = makeTuple(MAX_NEW_NOTE_HASHES_PER_TX, ScopedNoteHash.empty); + const noteHashes = makeTuple(MAX_NOTE_HASHES_PER_TX, ScopedNoteHash.empty); for (let i = 0; i < newNoteIndices.length; i++) { noteHashes[i] = new NoteHash(generateFakeSiloedCommitment(notesAndSlots[newNoteIndices[i]]), 0).scope( 0, @@ -94,7 +94,7 @@ describe('Kernel Prover', () => { ); } - publicInputs.end.newNoteHashes = noteHashes; + publicInputs.end.noteHashes = noteHashes; return { publicInputs, proof: makeRecursiveProof(NESTED_RECURSIVE_PROOF_LENGTH), @@ -104,11 +104,11 @@ describe('Kernel Prover', () => { const createProofOutputFinal = (newNoteIndices: number[]) => { const publicInputs = PrivateKernelTailCircuitPublicInputs.empty(); - const noteHashes = makeTuple(MAX_NEW_NOTE_HASHES_PER_TX, () => Fr.ZERO); + const noteHashes = makeTuple(MAX_NOTE_HASHES_PER_TX, () => Fr.ZERO); for (let i = 0; i < newNoteIndices.length; i++) { noteHashes[i] = generateFakeSiloedCommitment(notesAndSlots[newNoteIndices[i]]); } - publicInputs.forRollup!.end.newNoteHashes = noteHashes; + publicInputs.forRollup!.end.noteHashes = noteHashes; return { publicInputs, @@ -161,7 +161,7 @@ describe('Kernel Prover', () => { proofCreator = mock(); proofCreator.getSiloedCommitments.mockImplementation(publicInputs => - Promise.resolve(publicInputs.newNoteHashes.map(com => createFakeSiloedCommitment(com.value))), + Promise.resolve(publicInputs.noteHashes.map(com => createFakeSiloedCommitment(com.value))), ); proofCreator.createProofInit.mockResolvedValue(createProofOutput([])); proofCreator.createProofInner.mockResolvedValue(createProofOutput([])); diff --git a/yarn-project/pxe/src/kernel_prover/kernel_prover.ts b/yarn-project/pxe/src/kernel_prover/kernel_prover.ts index 33d62677e6c..c3d85a5d524 100644 --- a/yarn-project/pxe/src/kernel_prover/kernel_prover.ts +++ b/yarn-project/pxe/src/kernel_prover/kernel_prover.ts @@ -3,10 +3,10 @@ import { CallRequest, Fr, MAX_KEY_VALIDATION_REQUESTS_PER_TX, - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, NESTED_RECURSIVE_PROOF_LENGTH, @@ -159,12 +159,12 @@ export class KernelProver { private needsReset(executionStack: ExecutionResult[], output: KernelProofOutput) { const nextIteration = executionStack[executionStack.length - 1]; return ( - getNonEmptyItems(nextIteration.callStackItem.publicInputs.newNoteHashes).length + - getNonEmptyItems(output.publicInputs.end.newNoteHashes).length > - MAX_NEW_NOTE_HASHES_PER_TX || - getNonEmptyItems(nextIteration.callStackItem.publicInputs.newNullifiers).length + - getNonEmptyItems(output.publicInputs.end.newNullifiers).length > - MAX_NEW_NULLIFIERS_PER_TX || + getNonEmptyItems(nextIteration.callStackItem.publicInputs.noteHashes).length + + getNonEmptyItems(output.publicInputs.end.noteHashes).length > + MAX_NOTE_HASHES_PER_TX || + getNonEmptyItems(nextIteration.callStackItem.publicInputs.nullifiers).length + + getNonEmptyItems(output.publicInputs.end.nullifiers).length > + MAX_NULLIFIERS_PER_TX || getNonEmptyItems(nextIteration.callStackItem.publicInputs.noteEncryptedLogsHashes).length + getNonEmptyItems(output.publicInputs.end.noteEncryptedLogsHashes).length > MAX_NOTE_ENCRYPTED_LOGS_PER_TX || @@ -185,8 +185,8 @@ export class KernelProver { getNonEmptyItems(output.publicInputs.validationRequests.noteHashReadRequests).length > 0 || getNonEmptyItems(output.publicInputs.validationRequests.nullifierReadRequests).length > 0 || getNonEmptyItems(output.publicInputs.validationRequests.scopedKeyValidationRequestsAndGenerators).length > 0 || - output.publicInputs.end.newNoteHashes.find(noteHash => noteHash.nullifierCounter !== 0) || - output.publicInputs.end.newNullifiers.find(nullifier => !nullifier.nullifiedNoteHash.equals(Fr.zero())) + output.publicInputs.end.noteHashes.find(noteHash => noteHash.nullifierCounter !== 0) || + output.publicInputs.end.nullifiers.find(nullifier => !nullifier.nullifiedNoteHash.equals(Fr.zero())) ); } diff --git a/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_init_hints.ts b/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_init_hints.ts index bd5e305cede..833a7d252ff 100644 --- a/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_init_hints.ts +++ b/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_init_hints.ts @@ -1,5 +1,5 @@ import { - type MAX_NEW_NOTE_HASHES_PER_CALL, + type MAX_NOTE_HASHES_PER_CALL, type PrivateCircuitPublicInputs, PrivateKernelInitHints, } from '@aztec/circuits.js'; @@ -9,9 +9,10 @@ export function buildPrivateKernelInitHints( publicInputs: PrivateCircuitPublicInputs, noteHashNullifierCounterMap: Map, ) { - const nullifierCounters = publicInputs.newNoteHashes.map( - n => noteHashNullifierCounterMap.get(n.counter) ?? 0, - ) as Tuple; + const nullifierCounters = publicInputs.noteHashes.map(n => noteHashNullifierCounterMap.get(n.counter) ?? 0) as Tuple< + number, + typeof MAX_NOTE_HASHES_PER_CALL + >; return new PrivateKernelInitHints(nullifierCounters); } diff --git a/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_inner_hints.ts b/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_inner_hints.ts index a03ac365947..3eacc5d0719 100644 --- a/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_inner_hints.ts +++ b/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_inner_hints.ts @@ -1,5 +1,5 @@ import { - type MAX_NEW_NOTE_HASHES_PER_CALL, + type MAX_NOTE_HASHES_PER_CALL, type PrivateCircuitPublicInputs, PrivateKernelInnerHints, } from '@aztec/circuits.js'; @@ -9,9 +9,10 @@ export function buildPrivateKernelInnerHints( publicInputs: PrivateCircuitPublicInputs, noteHashNullifierCounterMap: Map, ) { - const nullifierCounters = publicInputs.newNoteHashes.map( - n => noteHashNullifierCounterMap.get(n.counter) ?? 0, - ) as Tuple; + const nullifierCounters = publicInputs.noteHashes.map(n => noteHashNullifierCounterMap.get(n.counter) ?? 0) as Tuple< + number, + typeof MAX_NOTE_HASHES_PER_CALL + >; return new PrivateKernelInnerHints(nullifierCounters); } diff --git a/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_reset_hints.ts b/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_reset_hints.ts index 9f60dbbbf8e..e23698c9715 100644 --- a/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_reset_hints.ts +++ b/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_reset_hints.ts @@ -2,10 +2,10 @@ import { type Fr, KeyValidationHint, MAX_KEY_VALIDATION_REQUESTS_PER_TX, - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MembershipWitness, NULLIFIER_TREE_HEIGHT, @@ -33,7 +33,7 @@ import { buildPrivateKernelResetOutputs } from './build_private_kernel_reset_out function getNullifierReadRequestHints( nullifierReadRequests: Tuple, - nullifiers: Tuple, + nullifiers: Tuple, oracle: ProvingDataOracle, sizePending: PENDING, sizeSettled: SETTLED, @@ -99,7 +99,7 @@ export async function buildPrivateKernelResetInputs( // Use max sizes, they will be trimmed down later. const futureNoteHashes = collectNested(executionStack, executionResult => { - const nonEmptyNoteHashes = getNonEmptyItems(executionResult.callStackItem.publicInputs.newNoteHashes); + const nonEmptyNoteHashes = getNonEmptyItems(executionResult.callStackItem.publicInputs.noteHashes); return nonEmptyNoteHashes.map( noteHash => new ScopedNoteHash( @@ -117,7 +117,7 @@ export async function buildPrivateKernelResetInputs( } = await buildNoteHashReadRequestHints( oracle, publicInputs.validationRequests.noteHashReadRequests, - publicInputs.end.newNoteHashes, + publicInputs.end.noteHashes, noteHashLeafIndexMap, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, @@ -125,7 +125,7 @@ export async function buildPrivateKernelResetInputs( ); const futureNullifiers = collectNested(executionStack, executionResult => { - const nonEmptyNullifiers = getNonEmptyItems(executionResult.callStackItem.publicInputs.newNullifiers); + const nonEmptyNullifiers = getNonEmptyItems(executionResult.callStackItem.publicInputs.nullifiers); return nonEmptyNullifiers.map( nullifier => new ScopedNullifier(nullifier, executionResult.callStackItem.publicInputs.callContext.storageContractAddress), @@ -138,7 +138,7 @@ export async function buildPrivateKernelResetInputs( hints: nullifierReadRequestHints, } = await getNullifierReadRequestHints( publicInputs.validationRequests.nullifierReadRequests, - publicInputs.end.newNullifiers, + publicInputs.end.nullifiers, oracle, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, @@ -164,19 +164,19 @@ export async function buildPrivateKernelResetInputs( transientNoteHashIndexesForNullifiers, transientNoteHashIndexesForLogs, ] = buildTransientDataHints( - publicInputs.end.newNoteHashes, - publicInputs.end.newNullifiers, + publicInputs.end.noteHashes, + publicInputs.end.nullifiers, publicInputs.end.noteEncryptedLogsHashes, futureNoteHashReads, futureNullifierReads, - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NOTE_HASHES_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, ); const expectedOutputs = buildPrivateKernelResetOutputs( - previousKernelData.publicInputs.end.newNoteHashes, - previousKernelData.publicInputs.end.newNullifiers, + previousKernelData.publicInputs.end.noteHashes, + previousKernelData.publicInputs.end.nullifiers, previousKernelData.publicInputs.end.noteEncryptedLogsHashes, transientNullifierIndexesForNoteHashes, transientNoteHashIndexesForNullifiers, diff --git a/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.ts b/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.ts index c05ed7a2587..a6426532f39 100644 --- a/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.ts +++ b/yarn-project/pxe/src/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.ts @@ -1,7 +1,7 @@ import { - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, + MAX_NULLIFIERS_PER_TX, NoteLogHash, PrivateKernelResetOutputs, ScopedNoteHash, @@ -11,28 +11,28 @@ import { padArrayEnd } from '@aztec/foundation/collection'; import { type Tuple } from '@aztec/foundation/serialize'; export function buildPrivateKernelResetOutputs( - prevNoteHashes: Tuple, - prevNullifiers: Tuple, + prevNoteHashes: Tuple, + prevNullifiers: Tuple, prevLogs: Tuple, - transientNullifierIndexesForNoteHashes: Tuple, - transientNoteHashIndexesForNullifiers: Tuple, + transientNullifierIndexesForNoteHashes: Tuple, + transientNoteHashIndexesForNullifiers: Tuple, ) { // Propagate note hashes that are not going to be squashed in the transient arrays. // A value isn't going to be squashed if the symmetrical index in the corresponding array is the length of the array. const noteHashes = padArrayEnd( - prevNoteHashes.filter((_, index) => transientNullifierIndexesForNoteHashes[index] === MAX_NEW_NULLIFIERS_PER_TX), + prevNoteHashes.filter((_, index) => transientNullifierIndexesForNoteHashes[index] === MAX_NULLIFIERS_PER_TX), ScopedNoteHash.empty(), - MAX_NEW_NOTE_HASHES_PER_TX, + MAX_NOTE_HASHES_PER_TX, ); const nullifiers = padArrayEnd( - prevNullifiers.filter((_, index) => transientNoteHashIndexesForNullifiers[index] === MAX_NEW_NOTE_HASHES_PER_TX), + prevNullifiers.filter((_, index) => transientNoteHashIndexesForNullifiers[index] === MAX_NOTE_HASHES_PER_TX), ScopedNullifier.empty(), - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NULLIFIERS_PER_TX, ); const nullifiedNotes = prevNoteHashes - .filter((_, index) => transientNullifierIndexesForNoteHashes[index] < MAX_NEW_NULLIFIERS_PER_TX) + .filter((_, index) => transientNullifierIndexesForNoteHashes[index] < MAX_NULLIFIERS_PER_TX) .map(n => n.counter); const logs = padArrayEnd( diff --git a/yarn-project/pxe/src/kernel_prover/test/test_circuit_prover.ts b/yarn-project/pxe/src/kernel_prover/test/test_circuit_prover.ts index 97ca1c230fc..b08dcdaeaac 100644 --- a/yarn-project/pxe/src/kernel_prover/test/test_circuit_prover.ts +++ b/yarn-project/pxe/src/kernel_prover/test/test_circuit_prover.ts @@ -33,9 +33,7 @@ export class TestProofCreator implements ProofCreator { public getSiloedCommitments(publicInputs: PrivateCircuitPublicInputs) { const contractAddress = publicInputs.callContext.storageContractAddress; - return Promise.resolve( - publicInputs.newNoteHashes.map(commitment => siloNoteHash(contractAddress, commitment.value)), - ); + return Promise.resolve(publicInputs.noteHashes.map(commitment => siloNoteHash(contractAddress, commitment.value))); } public async createProofInit( diff --git a/yarn-project/pxe/src/note_processor/note_processor.test.ts b/yarn-project/pxe/src/note_processor/note_processor.test.ts index 24de16e5143..7904fd9efc0 100644 --- a/yarn-project/pxe/src/note_processor/note_processor.test.ts +++ b/yarn-project/pxe/src/note_processor/note_processor.test.ts @@ -6,7 +6,7 @@ import { type GrumpkinPrivateKey, INITIAL_L2_BLOCK_NUM, KeyValidationRequest, - MAX_NEW_NOTE_HASHES_PER_TX, + MAX_NOTE_HASHES_PER_TX, type PublicKey, computeOvskApp, deriveKeys, @@ -27,7 +27,7 @@ import { type OutgoingNoteDao } from '../database/outgoing_note_dao.js'; import { NoteProcessor } from './note_processor.js'; const TXS_PER_BLOCK = 4; -const NUM_NOTE_HASHES_PER_BLOCK = TXS_PER_BLOCK * MAX_NEW_NOTE_HASHES_PER_TX; +const NUM_NOTE_HASHES_PER_BLOCK = TXS_PER_BLOCK * MAX_NOTE_HASHES_PER_TX; /** A wrapper containing info about a note we want to mock and insert into a block. */ class MockNoteRequest { @@ -48,8 +48,8 @@ class MockNoteRequest { if (blockNumber < INITIAL_L2_BLOCK_NUM) { throw new Error(`Block number should be greater than or equal to ${INITIAL_L2_BLOCK_NUM}.`); } - if (noteHashIndex >= MAX_NEW_NOTE_HASHES_PER_TX) { - throw new Error(`Data index should be less than ${MAX_NEW_NOTE_HASHES_PER_TX}.`); + if (noteHashIndex >= MAX_NOTE_HASHES_PER_TX) { + throw new Error(`Data index should be less than ${MAX_NOTE_HASHES_PER_TX}.`); } if (txIndex >= TXS_PER_BLOCK) { throw new Error(`Tx index should be less than ${TXS_PER_BLOCK}.`); @@ -65,9 +65,7 @@ class MockNoteRequest { get indexWithinNoteHashTree(): bigint { return BigInt( - (this.blockNumber - 1) * NUM_NOTE_HASHES_PER_BLOCK + - this.txIndex * MAX_NEW_NOTE_HASHES_PER_TX + - this.noteHashIndex, + (this.blockNumber - 1) * NUM_NOTE_HASHES_PER_BLOCK + this.txIndex * MAX_NOTE_HASHES_PER_TX + this.noteHashIndex, ); } } diff --git a/yarn-project/pxe/src/note_processor/note_processor.ts b/yarn-project/pxe/src/note_processor/note_processor.ts index 859309439d0..5fb9b4623cf 100644 --- a/yarn-project/pxe/src/note_processor/note_processor.ts +++ b/yarn-project/pxe/src/note_processor/note_processor.ts @@ -1,11 +1,6 @@ import { type AztecNode, L1NotePayload, type L2Block, TaggedLog } from '@aztec/circuit-types'; import { type NoteProcessorStats } from '@aztec/circuit-types/stats'; -import { - type AztecAddress, - INITIAL_L2_BLOCK_NUM, - MAX_NEW_NOTE_HASHES_PER_TX, - type PublicKey, -} from '@aztec/circuits.js'; +import { type AztecAddress, INITIAL_L2_BLOCK_NUM, MAX_NOTE_HASHES_PER_TX, type PublicKey } from '@aztec/circuits.js'; import { type Fr } from '@aztec/foundation/fields'; import { type Logger, createDebugLogger } from '@aztec/foundation/log'; import { Timer } from '@aztec/foundation/timer'; @@ -128,7 +123,7 @@ export class NoteProcessor { const { txLogs } = block.body.noteEncryptedLogs; const dataStartIndexForBlock = block.header.state.partial.noteHashTree.nextAvailableLeafIndex - - block.body.numberOfTxsIncludingPadded * MAX_NEW_NOTE_HASHES_PER_TX; + block.body.numberOfTxsIncludingPadded * MAX_NOTE_HASHES_PER_TX; // We are using set for `userPertainingTxIndices` to avoid duplicates. This would happen in case there were // multiple encrypted logs in a tx pertaining to a user. @@ -138,8 +133,8 @@ export class NoteProcessor { // Iterate over all the encrypted logs and try decrypting them. If successful, store the note. for (let indexOfTxInABlock = 0; indexOfTxInABlock < txLogs.length; ++indexOfTxInABlock) { this.stats.txs++; - const dataStartIndexForTx = dataStartIndexForBlock + indexOfTxInABlock * MAX_NEW_NOTE_HASHES_PER_TX; - const newNoteHashes = block.body.txEffects[indexOfTxInABlock].noteHashes; + const dataStartIndexForTx = dataStartIndexForBlock + indexOfTxInABlock * MAX_NOTE_HASHES_PER_TX; + const noteHashes = block.body.txEffects[indexOfTxInABlock].noteHashes; // Note: Each tx generates a `TxL2Logs` object and for this reason we can rely on its index corresponding // to the index of a tx in a block. const txFunctionLogs = txLogs[indexOfTxInABlock].functionLogs; @@ -172,7 +167,7 @@ export class NoteProcessor { outgoingTaggedNote ? this.ovpkM : undefined, payload, txHash, - newNoteHashes, + noteHashes, dataStartIndexForTx, excludedIndices, this.log, @@ -245,10 +240,10 @@ export class NoteProcessor { }); } - const newNullifiers: Fr[] = blocksAndNotes.flatMap(b => + const nullifiers: Fr[] = blocksAndNotes.flatMap(b => b.block.body.txEffects.flatMap(txEffect => txEffect.nullifiers), ); - const removedNotes = await this.db.removeNullifiedNotes(newNullifiers, this.ivpkM); + const removedNotes = await this.db.removeNullifiedNotes(nullifiers, this.ivpkM); removedNotes.forEach(noteDao => { this.log.verbose( `Removed note for contract ${noteDao.contractAddress} at slot ${ @@ -305,7 +300,7 @@ export class NoteProcessor { const outgoingNotes: OutgoingNoteDao[] = []; for (const deferredNote of deferredNoteDaos) { - const { publicKey, note, contractAddress, storageSlot, noteTypeId, txHash, newNoteHashes, dataStartIndexForTx } = + const { publicKey, note, contractAddress, storageSlot, noteTypeId, txHash, noteHashes, dataStartIndexForTx } = deferredNote; const payload = new L1NotePayload(note, contractAddress, storageSlot, noteTypeId); @@ -323,7 +318,7 @@ export class NoteProcessor { isOutgoing ? this.ovpkM : undefined, payload, txHash, - newNoteHashes, + noteHashes, dataStartIndexForTx, excludedIndices, this.log, diff --git a/yarn-project/pxe/src/note_processor/produce_note_dao.ts b/yarn-project/pxe/src/note_processor/produce_note_dao.ts index 9fc246a34fb..46d64c7125f 100644 --- a/yarn-project/pxe/src/note_processor/produce_note_dao.ts +++ b/yarn-project/pxe/src/note_processor/produce_note_dao.ts @@ -18,7 +18,7 @@ import { OutgoingNoteDao } from '../database/outgoing_note_dao.js'; * @param ovpkM - The public counterpart to the secret key to be used in the decryption of outgoing note logs. * @param payload - An instance of l1NotePayload. * @param txHash - The hash of the transaction that created the note. Equivalent to the first nullifier of the transaction. - * @param newNoteHashes - New note hashes in this transaction, one of which belongs to this note. + * @param noteHashes - New note hashes in this transaction, one of which belongs to this note. * @param dataStartIndexForTx - The next available leaf index for the note hash tree for this transaction. * @param excludedIndices - Indices that have been assigned a note in the same tx. Notes in a tx can have the same l1NotePayload, we need to find a different index for each replicate. * @param simulator - An instance of AcirSimulator. @@ -30,7 +30,7 @@ export async function produceNoteDaos( ovpkM: PublicKey | undefined, payload: L1NotePayload, txHash: TxHash, - newNoteHashes: Fr[], + noteHashes: Fr[], dataStartIndexForTx: number, excludedIndices: Set, log: Logger, @@ -53,7 +53,7 @@ export async function produceNoteDaos( if (ivpkM) { const { noteHashIndex, nonce, innerNoteHash, siloedNullifier } = await findNoteIndexAndNullifier( simulator, - newNoteHashes, + noteHashes, txHash, payload, excludedIndices, @@ -87,7 +87,7 @@ export async function produceNoteDaos( payload.storageSlot, payload.noteTypeId, txHash, - newNoteHashes, + noteHashes, dataStartIndexForTx, ); } @@ -115,7 +115,7 @@ export async function produceNoteDaos( } else { const { noteHashIndex, nonce, innerNoteHash } = await findNoteIndexAndNullifier( simulator, - newNoteHashes, + noteHashes, txHash, payload, excludedIndices, @@ -148,7 +148,7 @@ export async function produceNoteDaos( payload.storageSlot, payload.noteTypeId, txHash, - newNoteHashes, + noteHashes, dataStartIndexForTx, ); } diff --git a/yarn-project/sequencer-client/src/sequencer/sequencer.test.ts b/yarn-project/sequencer-client/src/sequencer/sequencer.test.ts index a0bdf943af3..89721ceafb9 100644 --- a/yarn-project/sequencer-client/src/sequencer/sequencer.test.ts +++ b/yarn-project/sequencer-client/src/sequencer/sequencer.test.ts @@ -214,7 +214,7 @@ describe('sequencer', () => { ); // We make a nullifier from tx1 a part of the nullifier tree, so it gets rejected as double spend - const doubleSpendNullifier = doubleSpendTx.data.forRollup!.end.newNullifiers[0].toBuffer(); + const doubleSpendNullifier = doubleSpendTx.data.forRollup!.end.nullifiers[0].toBuffer(); merkleTreeOps.findLeafIndex.mockImplementation((treeId: MerkleTreeId, value: any) => { return Promise.resolve( treeId === MerkleTreeId.NULLIFIER_TREE && value.equals(doubleSpendNullifier) ? 1n : undefined, diff --git a/yarn-project/sequencer-client/src/tx_validator/double_spend_validator.test.ts b/yarn-project/sequencer-client/src/tx_validator/double_spend_validator.test.ts index 5cf758a6cfd..cdca2861578 100644 --- a/yarn-project/sequencer-client/src/tx_validator/double_spend_validator.test.ts +++ b/yarn-project/sequencer-client/src/tx_validator/double_spend_validator.test.ts @@ -19,13 +19,13 @@ describe('DoubleSpendTxValidator', () => { it('rejects duplicates in non revertible data', async () => { const badTx = mockTxForRollup(); - badTx.data.forRollup!.end.newNullifiers[1] = badTx.data.forRollup!.end.newNullifiers[0]; + badTx.data.forRollup!.end.nullifiers[1] = badTx.data.forRollup!.end.nullifiers[0]; await expect(txValidator.validateTxs([badTx])).resolves.toEqual([[], [badTx]]); }); it('rejects duplicates in revertible data', async () => { const badTx = mockTxForRollup(); - badTx.data.forRollup!.end.newNullifiers[1] = badTx.data.forRollup!.end.newNullifiers[0]; + badTx.data.forRollup!.end.nullifiers[1] = badTx.data.forRollup!.end.nullifiers[0]; await expect(txValidator.validateTxs([badTx])).resolves.toEqual([[], [badTx]]); }); @@ -34,14 +34,14 @@ describe('DoubleSpendTxValidator', () => { numberOfNonRevertiblePublicCallRequests: 1, numberOfRevertiblePublicCallRequests: 1, }); - badTx.data.forPublic!.end.newNullifiers[0] = badTx.data.forPublic!.endNonRevertibleData.newNullifiers[0]; + badTx.data.forPublic!.end.nullifiers[0] = badTx.data.forPublic!.endNonRevertibleData.nullifiers[0]; await expect(txValidator.validateTxs([badTx])).resolves.toEqual([[], [badTx]]); }); it('rejects duplicates across txs', async () => { const firstTx = mockTxForRollup(1); const secondTx = mockTxForRollup(2); - secondTx.data.forRollup!.end.newNullifiers[0] = firstTx.data.forRollup!.end.newNullifiers[0]; + secondTx.data.forRollup!.end.nullifiers[0] = firstTx.data.forRollup!.end.nullifiers[0]; await expect(txValidator.validateTxs([firstTx, secondTx])).resolves.toEqual([[firstTx], [secondTx]]); }); diff --git a/yarn-project/sequencer-client/src/tx_validator/double_spend_validator.ts b/yarn-project/sequencer-client/src/tx_validator/double_spend_validator.ts index 62db72b5ec9..2b93fe73eb0 100644 --- a/yarn-project/sequencer-client/src/tx_validator/double_spend_validator.ts +++ b/yarn-project/sequencer-client/src/tx_validator/double_spend_validator.ts @@ -32,16 +32,16 @@ export class DoubleSpendTxValidator implements TxValidator { } async #uniqueNullifiers(tx: AnyTx, thisBlockNullifiers: Set): Promise { - const newNullifiers = tx.data.getNonEmptyNullifiers().map(x => x.toBigInt()); + const nullifiers = tx.data.getNonEmptyNullifiers().map(x => x.toBigInt()); // Ditch this tx if it has repeated nullifiers - const uniqueNullifiers = new Set(newNullifiers); - if (uniqueNullifiers.size !== newNullifiers.length) { + const uniqueNullifiers = new Set(nullifiers); + if (uniqueNullifiers.size !== nullifiers.length) { this.#log.warn(`Rejecting tx ${Tx.getHash(tx)} for emitting duplicate nullifiers`); return false; } - for (const nullifier of newNullifiers) { + for (const nullifier of nullifiers) { if (thisBlockNullifiers.has(nullifier)) { this.#log.warn(`Rejecting tx ${Tx.getHash(tx)} for repeating a nullifier in the same block`); return false; @@ -50,9 +50,7 @@ export class DoubleSpendTxValidator implements TxValidator { thisBlockNullifiers.add(nullifier); } - const nullifierIndexes = await Promise.all( - newNullifiers.map(n => this.#nullifierSource.getNullifierIndex(new Fr(n))), - ); + const nullifierIndexes = await Promise.all(nullifiers.map(n => this.#nullifierSource.getNullifierIndex(new Fr(n)))); const hasDuplicates = nullifierIndexes.some(index => index !== undefined); if (hasDuplicates) { diff --git a/yarn-project/simulator/src/avm/journal/journal.test.ts b/yarn-project/simulator/src/avm/journal/journal.test.ts index 7d001d3ee6a..9818c42be4b 100644 --- a/yarn-project/simulator/src/avm/journal/journal.test.ts +++ b/yarn-project/simulator/src/avm/journal/journal.test.ts @@ -252,7 +252,7 @@ describe('journal', () => { // }), // ]); - // expect(journalUpdates.newNoteHashes).toEqual([ + // expect(journalUpdates.noteHashes).toEqual([ // expect.objectContaining({ noteHash: commitment, storageAddress: contractAddress }), // expect.objectContaining({ noteHash: commitmentT1, storageAddress: contractAddress }), // ]); @@ -276,7 +276,7 @@ describe('journal', () => { // expect.objectContaining({ nullifier: commitment, exists: true }), // expect.objectContaining({ nullifier: commitmentT1, exists: true }), // ]); - // expect(journalUpdates.newNullifiers).toEqual([ + // expect(journalUpdates.nullifiers).toEqual([ // expect.objectContaining({ // storageAddress: contractAddress, // nullifier: commitment, @@ -386,7 +386,7 @@ describe('journal', () => { // ]); // // Check that the world state _traces_ are merged even on rejection - // expect(journalUpdates.newNoteHashes).toEqual([ + // expect(journalUpdates.noteHashes).toEqual([ // expect.objectContaining({ noteHash: commitment, storageAddress: contractAddress }), // expect.objectContaining({ noteHash: commitmentT1, storageAddress: contractAddress }), // ]); @@ -394,7 +394,7 @@ describe('journal', () => { // expect.objectContaining({ nullifier: commitment, exists: true }), // expect.objectContaining({ nullifier: commitmentT1, exists: true }), // ]); - // expect(journalUpdates.newNullifiers).toEqual([ + // expect(journalUpdates.nullifiers).toEqual([ // expect.objectContaining({ // storageAddress: contractAddress, // nullifier: commitment, diff --git a/yarn-project/simulator/src/client/client_execution_context.ts b/yarn-project/simulator/src/client/client_execution_context.ts index f8f78336619..33c2d5beec9 100644 --- a/yarn-project/simulator/src/client/client_execution_context.ts +++ b/yarn-project/simulator/src/client/client_execution_context.ts @@ -459,9 +459,9 @@ export class ClientExecutionContext extends ViewDataOracle { #checkValidStaticCall(childExecutionResult: ExecutionResult) { if ( - childExecutionResult.callStackItem.publicInputs.newNoteHashes.some(item => !item.isEmpty()) || - childExecutionResult.callStackItem.publicInputs.newNullifiers.some(item => !item.isEmpty()) || - childExecutionResult.callStackItem.publicInputs.newL2ToL1Msgs.some(item => !item.isEmpty()) || + childExecutionResult.callStackItem.publicInputs.noteHashes.some(item => !item.isEmpty()) || + childExecutionResult.callStackItem.publicInputs.nullifiers.some(item => !item.isEmpty()) || + childExecutionResult.callStackItem.publicInputs.l2ToL1Msgs.some(item => !item.isEmpty()) || childExecutionResult.callStackItem.publicInputs.encryptedLogsHashes.some(item => !item.isEmpty()) || childExecutionResult.callStackItem.publicInputs.unencryptedLogsHashes.some(item => !item.isEmpty()) ) { diff --git a/yarn-project/simulator/src/client/private_execution.test.ts b/yarn-project/simulator/src/client/private_execution.test.ts index 8b439279a91..7eeb02a34d1 100644 --- a/yarn-project/simulator/src/client/private_execution.test.ts +++ b/yarn-project/simulator/src/client/private_execution.test.ts @@ -313,7 +313,7 @@ describe('Private Execution test suite', () => { // noteHashes. A TX's real first nullifier (generated by the initial kernel) and a noteHash's // array index at the output of the final kernel/ordering circuit are used to derive nonce via: // `hash(firstNullifier, noteHashIndex)` - const noteHashIndex = randomInt(1); // mock index in TX's final newNoteHashes array + const noteHashIndex = randomInt(1); // mock index in TX's final noteHashes array const nonce = computeNoteHashNonce(mockFirstNullifier, noteHashIndex); const note = new Note([new Fr(amount), ownerNpkMHash, Fr.random()]); const innerNoteHash = pedersenHash(note.items); @@ -352,9 +352,9 @@ describe('Private Execution test suite', () => { expect(newNote.storageSlot).toEqual(computeSlotForMapping(new Fr(1n), owner)); expect(newNote.noteTypeId).toEqual(valueNoteTypeId); // ValueNote - const newNoteHashes = getNonEmptyItems(result.callStackItem.publicInputs.newNoteHashes); - expect(newNoteHashes).toHaveLength(1); - expect(newNoteHashes[0].value).toEqual( + const noteHashes = getNonEmptyItems(result.callStackItem.publicInputs.noteHashes); + expect(noteHashes).toHaveLength(1); + expect(noteHashes[0].value).toEqual( await acirSimulator.computeInnerNoteHash( contractAddress, newNote.storageSlot, @@ -367,7 +367,7 @@ describe('Private Execution test suite', () => { expect(newEncryptedLogs).toHaveLength(1); const [encryptedLog] = newEncryptedLogs; - expect(encryptedLog.noteHashCounter).toEqual(newNoteHashes[0].counter); + expect(encryptedLog.noteHashCounter).toEqual(noteHashes[0].counter); expect(encryptedLog.value).toEqual(Fr.fromBuffer(result.noteEncryptedLogs[0].log.hash())); expect(encryptedLog.length).toEqual(new Fr(getEncryptedNoteSerializedLength(result))); }); @@ -382,9 +382,9 @@ describe('Private Execution test suite', () => { expect(newNote.storageSlot).toEqual(computeSlotForMapping(new Fr(1n), owner)); expect(newNote.noteTypeId).toEqual(valueNoteTypeId); // ValueNote - const newNoteHashes = getNonEmptyItems(result.callStackItem.publicInputs.newNoteHashes); - expect(newNoteHashes).toHaveLength(1); - expect(newNoteHashes[0].value).toEqual( + const noteHashes = getNonEmptyItems(result.callStackItem.publicInputs.noteHashes); + expect(noteHashes).toHaveLength(1); + expect(noteHashes[0].value).toEqual( await acirSimulator.computeInnerNoteHash( contractAddress, newNote.storageSlot, @@ -397,7 +397,7 @@ describe('Private Execution test suite', () => { expect(newEncryptedLogs).toHaveLength(1); const [encryptedLog] = newEncryptedLogs; - expect(encryptedLog.noteHashCounter).toEqual(newNoteHashes[0].counter); + expect(encryptedLog.noteHashCounter).toEqual(noteHashes[0].counter); expect(encryptedLog.value).toEqual(Fr.fromBuffer(result.noteEncryptedLogs[0].log.hash())); expect(encryptedLog.length).toEqual(new Fr(getEncryptedNoteSerializedLength(result))); }); @@ -434,18 +434,18 @@ describe('Private Execution test suite', () => { const result = await runSimulator({ args, artifact, msgSender: owner }); // The two notes were nullified - const newNullifiers = getNonEmptyItems(result.callStackItem.publicInputs.newNullifiers).map(n => n.value); - expect(newNullifiers).toHaveLength(consumedNotes.length); - expect(newNullifiers).toEqual(expect.arrayContaining(consumedNotes.map(n => n.innerNullifier))); + const nullifiers = getNonEmptyItems(result.callStackItem.publicInputs.nullifiers).map(n => n.value); + expect(nullifiers).toHaveLength(consumedNotes.length); + expect(nullifiers).toEqual(expect.arrayContaining(consumedNotes.map(n => n.innerNullifier))); expect(result.newNotes).toHaveLength(2); const [changeNote, recipientNote] = result.newNotes; expect(recipientNote.storageSlot).toEqual(recipientStorageSlot); expect(recipientNote.noteTypeId).toEqual(valueNoteTypeId); - const newNoteHashes = getNonEmptyItems(result.callStackItem.publicInputs.newNoteHashes); - expect(newNoteHashes).toHaveLength(2); - const [changeNoteHash, recipientNoteHash] = newNoteHashes; + const noteHashes = getNonEmptyItems(result.callStackItem.publicInputs.noteHashes); + expect(noteHashes).toHaveLength(2); + const [changeNoteHash, recipientNoteHash] = noteHashes; const [recipientInnerNoteHash, changeInnerNoteHash] = [ await acirSimulator.computeInnerNoteHash( contractAddress, @@ -510,8 +510,8 @@ describe('Private Execution test suite', () => { const args = [recipient, amountToTransfer]; const result = await runSimulator({ args, artifact, msgSender: owner }); - const newNullifiers = getNonEmptyItems(result.callStackItem.publicInputs.newNullifiers).map(n => n.value); - expect(newNullifiers).toEqual(consumedNotes.map(n => n.innerNullifier)); + const nullifiers = getNonEmptyItems(result.callStackItem.publicInputs.nullifiers).map(n => n.value); + expect(nullifiers).toEqual(consumedNotes.map(n => n.innerNullifier)); expect(result.newNotes).toHaveLength(2); const [changeNote, recipientNote] = result.newNotes; @@ -522,9 +522,9 @@ describe('Private Execution test suite', () => { expect(newEncryptedLogs).toHaveLength(2); const [encryptedChangeLog, encryptedRecipientLog] = newEncryptedLogs; expect(encryptedChangeLog.value).toEqual(Fr.fromBuffer(result.noteEncryptedLogs[0].log.hash())); - expect(encryptedChangeLog.noteHashCounter).toEqual(result.callStackItem.publicInputs.newNoteHashes[0].counter); + expect(encryptedChangeLog.noteHashCounter).toEqual(result.callStackItem.publicInputs.noteHashes[0].counter); expect(encryptedRecipientLog.value).toEqual(Fr.fromBuffer(result.noteEncryptedLogs[1].log.hash())); - expect(encryptedRecipientLog.noteHashCounter).toEqual(result.callStackItem.publicInputs.newNoteHashes[1].counter); + expect(encryptedRecipientLog.noteHashCounter).toEqual(result.callStackItem.publicInputs.noteHashes[1].counter); expect(encryptedChangeLog.length.add(encryptedRecipientLog.length)).toEqual( new Fr(getEncryptedNoteSerializedLength(result)), ); @@ -678,8 +678,8 @@ describe('Private Execution test suite', () => { }); // Check a nullifier has been inserted - const newNullifiers = getNonEmptyItems(result.callStackItem.publicInputs.newNullifiers); - expect(newNullifiers).toHaveLength(1); + const nullifiers = getNonEmptyItems(result.callStackItem.publicInputs.nullifiers); + expect(nullifiers).toHaveLength(1); }); it('Invalid membership proof', async () => { @@ -841,8 +841,8 @@ describe('Private Execution test suite', () => { const result = await runSimulator({ artifact, args: [secret] }); // Check a nullifier has been inserted. - const newNullifiers = getNonEmptyItems(result.callStackItem.publicInputs.newNullifiers); - expect(newNullifiers).toHaveLength(1); + const nullifiers = getNonEmptyItems(result.callStackItem.publicInputs.nullifiers); + expect(nullifiers).toHaveLength(1); // Check the commitment read request was created successfully. const readRequests = getNonEmptyItems(result.callStackItem.publicInputs.noteHashReadRequests); @@ -972,10 +972,10 @@ describe('Private Execution test suite', () => { expect(noteAndSlot.note.items[0]).toEqual(new Fr(amountToTransfer)); - const newNoteHashes = getNonEmptyItems(result.callStackItem.publicInputs.newNoteHashes); - expect(newNoteHashes).toHaveLength(1); + const noteHashes = getNonEmptyItems(result.callStackItem.publicInputs.noteHashes); + expect(noteHashes).toHaveLength(1); - const noteHash = newNoteHashes[0].value; + const noteHash = noteHashes[0].value; const storageSlot = computeSlotForMapping( PendingNoteHashesContractArtifact.storageLayout['balances'].slot, owner, @@ -993,7 +993,7 @@ describe('Private Execution test suite', () => { expect(newEncryptedLogs).toHaveLength(1); const [encryptedLog] = newEncryptedLogs; - expect(encryptedLog.noteHashCounter).toEqual(newNoteHashes[0].counter); + expect(encryptedLog.noteHashCounter).toEqual(noteHashes[0].counter); expect(encryptedLog.noteHashCounter).toEqual(result.noteEncryptedLogs[0].noteHashCounter); expect(encryptedLog.value).toEqual(Fr.fromBuffer(result.noteEncryptedLogs[0].log.hash())); @@ -1003,7 +1003,7 @@ describe('Private Execution test suite', () => { expect(result.returnValues).toEqual([new Fr(amountToTransfer)]); - const nullifier = result.callStackItem.publicInputs.newNullifiers[0]; + const nullifier = result.callStackItem.publicInputs.nullifiers[0]; const expectedNullifier = poseidon2Hash([ innerNoteHash, computeAppNullifierSecretKey(ownerNskM, contractAddress), @@ -1061,10 +1061,10 @@ describe('Private Execution test suite', () => { expect(noteAndSlot.note.items[0]).toEqual(new Fr(amountToTransfer)); - const newNoteHashes = getNonEmptyItems(execInsert.callStackItem.publicInputs.newNoteHashes); - expect(newNoteHashes).toHaveLength(1); + const noteHashes = getNonEmptyItems(execInsert.callStackItem.publicInputs.noteHashes); + expect(noteHashes).toHaveLength(1); - const noteHash = newNoteHashes[0].value; + const noteHash = noteHashes[0].value; const innerNoteHash = await acirSimulator.computeInnerNoteHash( contractAddress, noteAndSlot.storageSlot, @@ -1077,7 +1077,7 @@ describe('Private Execution test suite', () => { expect(newEncryptedLogs).toHaveLength(1); const [encryptedLog] = newEncryptedLogs; - expect(encryptedLog.noteHashCounter).toEqual(newNoteHashes[0].counter); + expect(encryptedLog.noteHashCounter).toEqual(noteHashes[0].counter); expect(encryptedLog.noteHashCounter).toEqual(execInsert.noteEncryptedLogs[0].noteHashCounter); expect(encryptedLog.value).toEqual(Fr.fromBuffer(execInsert.noteEncryptedLogs[0].log.hash())); @@ -1087,7 +1087,7 @@ describe('Private Execution test suite', () => { expect(execGetThenNullify.returnValues).toEqual([new Fr(amountToTransfer)]); - const nullifier = execGetThenNullify.callStackItem.publicInputs.newNullifiers[0]; + const nullifier = execGetThenNullify.callStackItem.publicInputs.nullifiers[0]; const expectedNullifier = poseidon2Hash([ innerNoteHash, computeAppNullifierSecretKey(ownerNskM, contractAddress), diff --git a/yarn-project/simulator/src/mocks/fixtures.ts b/yarn-project/simulator/src/mocks/fixtures.ts index 0ce4c87bc71..2dd199084a1 100644 --- a/yarn-project/simulator/src/mocks/fixtures.ts +++ b/yarn-project/simulator/src/mocks/fixtures.ts @@ -128,9 +128,9 @@ export class PublicExecutionResultBuilder { l1ToL2MsgReadRequests: [], contractStorageUpdateRequests: this._contractStorageUpdateRequests, returnValues: padArrayEnd(this._returnValues, Fr.ZERO, 4), // TODO(#5450) Need to use the proper return values here - newNoteHashes: [], - newNullifiers: [], - newL2ToL1Messages: [], + noteHashes: [], + nullifiers: [], + l2ToL1Messages: [], contractStorageReads: [], unencryptedLogsHashes: [], unencryptedLogs: UnencryptedFunctionL2Logs.empty(), diff --git a/yarn-project/simulator/src/public/abstract_phase_manager.test.ts b/yarn-project/simulator/src/public/abstract_phase_manager.test.ts index 58a2881e537..d17cd896a4e 100644 --- a/yarn-project/simulator/src/public/abstract_phase_manager.test.ts +++ b/yarn-project/simulator/src/public/abstract_phase_manager.test.ts @@ -10,16 +10,16 @@ describe('AbstractPhaseManager utils', () => { const startingCounter = AbstractPhaseManager.getMaxSideEffectCounter(inputs); - inputs.endNonRevertibleData.newNoteHashes.at(-1)!.counter = startingCounter + 1; + inputs.endNonRevertibleData.noteHashes.at(-1)!.counter = startingCounter + 1; expect(AbstractPhaseManager.getMaxSideEffectCounter(inputs)).toBe(startingCounter + 1); inputs.endNonRevertibleData.publicCallStack.at(-1)!.startSideEffectCounter = new Fr(startingCounter + 2); expect(AbstractPhaseManager.getMaxSideEffectCounter(inputs)).toBe(startingCounter + 2); - inputs.end.newNoteHashes.at(-1)!.counter = startingCounter + 3; + inputs.end.noteHashes.at(-1)!.counter = startingCounter + 3; expect(AbstractPhaseManager.getMaxSideEffectCounter(inputs)).toBe(startingCounter + 3); - inputs.end.newNullifiers.at(-1)!.counter = startingCounter + 4; + inputs.end.nullifiers.at(-1)!.counter = startingCounter + 4; expect(AbstractPhaseManager.getMaxSideEffectCounter(inputs)).toBe(startingCounter + 4); }); }); diff --git a/yarn-project/simulator/src/public/abstract_phase_manager.ts b/yarn-project/simulator/src/public/abstract_phase_manager.ts index e055c85d3bf..ec278a3c9a5 100644 --- a/yarn-project/simulator/src/public/abstract_phase_manager.ts +++ b/yarn-project/simulator/src/public/abstract_phase_manager.ts @@ -25,10 +25,10 @@ import { L2ToL1Message, LogHash, MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL, - MAX_NEW_L2_TO_L1_MSGS_PER_CALL, - MAX_NEW_NOTE_HASHES_PER_CALL, - MAX_NEW_NULLIFIERS_PER_CALL, + MAX_L2_TO_L1_MSGS_PER_CALL, + MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, + MAX_NULLIFIERS_PER_CALL, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, @@ -375,7 +375,7 @@ export abstract class AbstractPhaseManager { /** Returns all pending private and public nullifiers. */ private getSiloedPendingNullifiers(ko: PublicKernelCircuitPublicInputs) { - return [...ko.end.newNullifiers, ...ko.endNonRevertibleData.newNullifiers].filter(n => !n.isEmpty()); + return [...ko.end.nullifiers, ...ko.endNonRevertibleData.nullifiers].filter(n => !n.isEmpty()); } protected getAvailableGas(tx: Tx, previousPublicKernelOutput: PublicKernelCircuitPublicInputs) { @@ -433,9 +433,9 @@ export abstract class AbstractPhaseManager { callContext: result.executionRequest.callContext, proverAddress: AztecAddress.ZERO, argsHash: computeVarArgsHash(result.executionRequest.args), - newNoteHashes: padArrayEnd(result.newNoteHashes, NoteHash.empty(), MAX_NEW_NOTE_HASHES_PER_CALL), - newNullifiers: padArrayEnd(result.newNullifiers, Nullifier.empty(), MAX_NEW_NULLIFIERS_PER_CALL), - newL2ToL1Msgs: padArrayEnd(result.newL2ToL1Messages, L2ToL1Message.empty(), MAX_NEW_L2_TO_L1_MSGS_PER_CALL), + noteHashes: padArrayEnd(result.noteHashes, NoteHash.empty(), MAX_NOTE_HASHES_PER_CALL), + nullifiers: padArrayEnd(result.nullifiers, Nullifier.empty(), MAX_NULLIFIERS_PER_CALL), + l2ToL1Msgs: padArrayEnd(result.l2ToL1Messages, L2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_CALL), startSideEffectCounter: result.startSideEffectCounter, endSideEffectCounter: result.endSideEffectCounter, returnsHash: computeVarArgsHash(result.returnValues), @@ -506,15 +506,15 @@ export abstract class AbstractPhaseManager { */ static getMaxSideEffectCounter(inputs: PublicKernelCircuitPublicInputs): number { const sideEffectCounters = [ - ...inputs.endNonRevertibleData.newNoteHashes, - ...inputs.endNonRevertibleData.newNullifiers, + ...inputs.endNonRevertibleData.noteHashes, + ...inputs.endNonRevertibleData.nullifiers, ...inputs.endNonRevertibleData.noteEncryptedLogsHashes, ...inputs.endNonRevertibleData.encryptedLogsHashes, ...inputs.endNonRevertibleData.unencryptedLogsHashes, ...inputs.endNonRevertibleData.publicCallStack, ...inputs.endNonRevertibleData.publicDataUpdateRequests, - ...inputs.end.newNoteHashes, - ...inputs.end.newNullifiers, + ...inputs.end.noteHashes, + ...inputs.end.nullifiers, ...inputs.end.noteEncryptedLogsHashes, ...inputs.end.encryptedLogsHashes, ...inputs.end.unencryptedLogsHashes, diff --git a/yarn-project/simulator/src/public/execution.ts b/yarn-project/simulator/src/public/execution.ts index 75fe296a285..a95fee4bbb5 100644 --- a/yarn-project/simulator/src/public/execution.ts +++ b/yarn-project/simulator/src/public/execution.ts @@ -48,11 +48,11 @@ export interface PublicExecutionResult { /** The contract storage update requests performed by the function. */ contractStorageUpdateRequests: ContractStorageUpdateRequest[]; /** The new note hashes to be inserted into the note hashes tree. */ - newNoteHashes: NoteHash[]; + noteHashes: NoteHash[]; /** The new l2 to l1 messages generated in this call. */ - newL2ToL1Messages: L2ToL1Message[]; + l2ToL1Messages: L2ToL1Message[]; /** The new nullifiers to be inserted into the nullifier tree. */ - newNullifiers: Nullifier[]; + nullifiers: Nullifier[]; /** The note hash read requests emitted in this call. */ noteHashReadRequests: ReadRequest[]; /** The nullifier read requests emitted in this call. */ @@ -115,17 +115,17 @@ export function isPublicExecutionResult( */ export function checkValidStaticCall( - newNoteHashes: NoteHash[], - newNullifiers: Nullifier[], + noteHashes: NoteHash[], + nullifiers: Nullifier[], contractStorageUpdateRequests: ContractStorageUpdateRequest[], - newL2ToL1Messages: L2ToL1Message[], + l2ToL1Messages: L2ToL1Message[], unencryptedLogs: UnencryptedFunctionL2Logs, ) { if ( contractStorageUpdateRequests.length > 0 || - newNoteHashes.length > 0 || - newNullifiers.length > 0 || - newL2ToL1Messages.length > 0 || + noteHashes.length > 0 || + nullifiers.length > 0 || + l2ToL1Messages.length > 0 || unencryptedLogs.logs.length > 0 ) { throw new Error('Static call cannot update the state, emit L2->L1 messages or generate logs'); diff --git a/yarn-project/simulator/src/public/hints_builder.ts b/yarn-project/simulator/src/public/hints_builder.ts index b7ee0e0506f..7846f10f152 100644 --- a/yarn-project/simulator/src/public/hints_builder.ts +++ b/yarn-project/simulator/src/public/hints_builder.ts @@ -1,7 +1,7 @@ import { MerkleTreeId } from '@aztec/circuit-types'; import { type Fr, - type MAX_NEW_NULLIFIERS_PER_TX, + type MAX_NULLIFIERS_PER_TX, type MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, type MAX_PUBLIC_DATA_HINTS, @@ -30,7 +30,7 @@ export class HintsBuilder { async getNullifierReadRequestHints( nullifierReadRequests: Tuple, - pendingNullifiers: Tuple, + pendingNullifiers: Tuple, ) { return ( await buildSiloedNullifierReadRequestHints( @@ -45,7 +45,7 @@ export class HintsBuilder { getNullifierNonExistentReadRequestHints( nullifierNonExistentReadRequests: Tuple, - pendingNullifiers: Tuple, + pendingNullifiers: Tuple, ) { return buildNullifierNonExistentReadRequestHints(this, nullifierNonExistentReadRequests, pendingNullifiers); } 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 04718e60f5e..63337b13735 100644 --- a/yarn-project/simulator/src/public/side_effect_trace.test.ts +++ b/yarn-project/simulator/src/public/side_effect_trace.test.ts @@ -115,7 +115,7 @@ describe('Side Effect Trace', () => { expect(trace.getCounter()).toBe(startCounterPlus1); const pxResult = toPxResult(trace); - expect(pxResult.newNoteHashes).toEqual([ + expect(pxResult.noteHashes).toEqual([ { //storageAddress: contractAddress, value: utxo, @@ -163,7 +163,7 @@ describe('Side Effect Trace', () => { expect(trace.getCounter()).toBe(startCounterPlus1); const pxResult = toPxResult(trace); - expect(pxResult.newNullifiers).toEqual([ + expect(pxResult.nullifiers).toEqual([ { value: utxo, counter: startCounter, @@ -197,7 +197,7 @@ describe('Side Effect Trace', () => { expect(trace.getCounter()).toBe(startCounterPlus1); const pxResult = toPxResult(trace); - expect(pxResult.newL2ToL1Messages).toEqual([ + expect(pxResult.l2ToL1Messages).toEqual([ new L2ToL1Message(EthAddress.fromField(recipient), content, startCounter), ]); }); diff --git a/yarn-project/simulator/src/public/side_effect_trace.ts b/yarn-project/simulator/src/public/side_effect_trace.ts index 79181547ebb..c397db272ac 100644 --- a/yarn-project/simulator/src/public/side_effect_trace.ts +++ b/yarn-project/simulator/src/public/side_effect_trace.ts @@ -39,11 +39,11 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface { private contractStorageUpdateRequests: ContractStorageUpdateRequest[] = []; private noteHashReadRequests: ReadRequest[] = []; - private newNoteHashes: NoteHash[] = []; + private noteHashes: NoteHash[] = []; private nullifierReadRequests: ReadRequest[] = []; private nullifierNonExistentReadRequests: ReadRequest[] = []; - private newNullifiers: Nullifier[] = []; + private nullifiers: Nullifier[] = []; private l1ToL2MsgReadRequests: ReadRequest[] = []; private newL2ToL1Messages: L2ToL1Message[] = []; @@ -122,7 +122,7 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface { // 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), // and will then propagate the actually-present noteHash to its public inputs. - this.newNoteHashes.push(new NoteHash(noteHash, this.sideEffectCounter)); + this.noteHashes.push(new NoteHash(noteHash, this.sideEffectCounter)); this.logger.debug(`NEW_NOTE_HASH cnt: ${this.sideEffectCounter}`); this.incrementSideEffectCounter(); } @@ -147,7 +147,7 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface { public traceNewNullifier(_storageAddress: 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 - this.newNullifiers.push(new Nullifier(nullifier, this.sideEffectCounter, /*noteHash=*/ Fr.ZERO)); + this.nullifiers.push(new Nullifier(nullifier, this.sideEffectCounter, /*noteHash=*/ Fr.ZERO)); this.logger.debug(`NEW_NULLIFIER cnt: ${this.sideEffectCounter}`); this.incrementSideEffectCounter(); } @@ -294,12 +294,12 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface { contractStorageReads: this.contractStorageReads, contractStorageUpdateRequests: this.contractStorageUpdateRequests, noteHashReadRequests: this.noteHashReadRequests, - newNoteHashes: this.newNoteHashes, + noteHashes: this.noteHashes, nullifierReadRequests: this.nullifierReadRequests, nullifierNonExistentReadRequests: this.nullifierNonExistentReadRequests, - newNullifiers: this.newNullifiers, + nullifiers: this.nullifiers, l1ToL2MsgReadRequests: this.l1ToL2MsgReadRequests, - newL2ToL1Messages: this.newL2ToL1Messages, + l2ToL1Messages: this.newL2ToL1Messages, // correct the type on these now that they are finalized (lists won't grow) unencryptedLogs: new UnencryptedFunctionL2Logs(this.unencryptedLogs), allUnencryptedLogs: new UnencryptedFunctionL2Logs(this.allUnencryptedLogs), diff --git a/yarn-project/simulator/src/public/tail_phase_manager.ts b/yarn-project/simulator/src/public/tail_phase_manager.ts index d0f547751d5..940c6621870 100644 --- a/yarn-project/simulator/src/public/tail_phase_manager.ts +++ b/yarn-project/simulator/src/public/tail_phase_manager.ts @@ -4,7 +4,7 @@ import { type GlobalVariables, type Header, type KernelCircuitPublicInputs, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, type PublicKernelCircuitPublicInputs, PublicKernelTailCircuitPrivateInputs, @@ -69,9 +69,9 @@ export class TailPhaseManager extends AbstractPhaseManager { const { validationRequests, endNonRevertibleData: nonRevertibleData, end: revertibleData } = previousOutput; const pendingNullifiers = mergeAccumulatedData( - nonRevertibleData.newNullifiers, - revertibleData.newNullifiers, - MAX_NEW_NULLIFIERS_PER_TX, + nonRevertibleData.nullifiers, + revertibleData.nullifiers, + MAX_NULLIFIERS_PER_TX, ); const nullifierReadRequestHints = await this.hintsBuilder.getNullifierReadRequestHints( diff --git a/yarn-project/txe/src/oracle/txe_oracle.ts b/yarn-project/txe/src/oracle/txe_oracle.ts index d69e5c289ec..be9bc639041 100644 --- a/yarn-project/txe/src/oracle/txe_oracle.ts +++ b/yarn-project/txe/src/oracle/txe_oracle.ts @@ -617,12 +617,12 @@ export class TXE implements TypedOracle { await this.addNullifiers( targetContractAddress, - publicInputs.newNullifiers.filter(nullifier => !nullifier.isEmpty()).map(nullifier => nullifier.value), + publicInputs.nullifiers.filter(nullifier => !nullifier.isEmpty()).map(nullifier => nullifier.value), ); await this.addNoteHashes( targetContractAddress, - publicInputs.newNoteHashes.filter(noteHash => !noteHash.isEmpty()).map(noteHash => noteHash.value), + publicInputs.noteHashes.filter(noteHash => !noteHash.isEmpty()).map(noteHash => noteHash.value), ); return callStackItem; diff --git a/yarn-project/world-state/src/world-state-db/merkle_tree_db.ts b/yarn-project/world-state/src/world-state-db/merkle_tree_db.ts index 1e485b439e2..4cee2af4522 100644 --- a/yarn-project/world-state/src/world-state-db/merkle_tree_db.ts +++ b/yarn-project/world-state/src/world-state-db/merkle_tree_db.ts @@ -1,5 +1,5 @@ import { type MerkleTreeId } from '@aztec/circuit-types'; -import { type Fr, MAX_NEW_NULLIFIERS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX } from '@aztec/circuits.js'; +import { type Fr, MAX_NULLIFIERS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX } from '@aztec/circuits.js'; import { type IndexedTreeSnapshot, type TreeSnapshot } from '@aztec/merkle-tree'; import { type MerkleTreeOperations } from './merkle_tree_operations.js'; @@ -19,7 +19,7 @@ import { type MerkleTreeOperations } from './merkle_tree_operations.js'; * 1024 leaves for the first block, because there's only neat space for 1023 leaves after 0. By padding with 1023 * more leaves, we can then insert the first block of 1024 leaves into indices 1024:2047. */ -export const INITIAL_NULLIFIER_TREE_SIZE = 2 * MAX_NEW_NULLIFIERS_PER_TX; +export const INITIAL_NULLIFIER_TREE_SIZE = 2 * MAX_NULLIFIERS_PER_TX; export const INITIAL_PUBLIC_DATA_TREE_SIZE = 2 * MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX; diff --git a/yarn-project/world-state/src/world-state-db/merkle_trees.ts b/yarn-project/world-state/src/world-state-db/merkle_trees.ts index be41f087fdc..5d8be02b4dd 100644 --- a/yarn-project/world-state/src/world-state-db/merkle_trees.ts +++ b/yarn-project/world-state/src/world-state-db/merkle_trees.ts @@ -7,8 +7,8 @@ import { GlobalVariables, Header, L1_TO_L2_MSG_TREE_HEIGHT, - MAX_NEW_NOTE_HASHES_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, + MAX_NOTE_HASHES_PER_TX, + MAX_NULLIFIERS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, NOTE_HASH_TREE_HEIGHT, NULLIFIER_SUBTREE_HEIGHT, @@ -592,7 +592,7 @@ export class MerkleTrees implements MerkleTreeDb { // Sync the append only trees { const noteHashesPadded = paddedTxEffects.flatMap(txEffect => - padArrayEnd(txEffect.noteHashes, Fr.ZERO, MAX_NEW_NOTE_HASHES_PER_TX), + padArrayEnd(txEffect.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), ); await this.#appendLeaves(MerkleTreeId.NOTE_HASH_TREE, noteHashesPadded); @@ -603,7 +603,7 @@ export class MerkleTrees implements MerkleTreeDb { // Sync the indexed trees { const nullifiersPadded = paddedTxEffects.flatMap(txEffect => - padArrayEnd(txEffect.nullifiers, Fr.ZERO, MAX_NEW_NULLIFIERS_PER_TX), + padArrayEnd(txEffect.nullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX), ); await (this.trees[MerkleTreeId.NULLIFIER_TREE] as StandardIndexedTree).batchInsert( nullifiersPadded.map(nullifier => nullifier.toBuffer()),