@aztec/stdlib 4.1.0-rc.4 → 4.2.0-nightly.20260320

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dest/avm/avm_accumulated_data.js +2 -2
  2. package/dest/avm/avm_circuit_public_inputs.js +2 -2
  3. package/dest/checkpoint/validate.js +2 -2
  4. package/dest/gas/gas_fees.d.ts +1 -1
  5. package/dest/gas/gas_fees.d.ts.map +1 -1
  6. package/dest/gas/gas_fees.js +4 -1
  7. package/dest/hash/hash.d.ts +16 -1
  8. package/dest/hash/hash.d.ts.map +1 -1
  9. package/dest/hash/hash.js +24 -0
  10. package/dest/interfaces/aztec-node-admin.d.ts +4 -1
  11. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  12. package/dest/interfaces/aztec-node.d.ts +2 -1
  13. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  14. package/dest/interfaces/block-builder.d.ts +25 -6
  15. package/dest/interfaces/block-builder.d.ts.map +1 -1
  16. package/dest/interfaces/configs.d.ts +7 -2
  17. package/dest/interfaces/configs.d.ts.map +1 -1
  18. package/dest/interfaces/configs.js +1 -0
  19. package/dest/interfaces/world_state.d.ts +5 -4
  20. package/dest/interfaces/world_state.d.ts.map +1 -1
  21. package/dest/kernel/claimed_length_array.js +1 -1
  22. package/dest/kernel/hints/private_kernel_reset_hints.d.ts +1 -1
  23. package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
  24. package/dest/kernel/padded_side_effects.js +1 -1
  25. package/dest/kernel/private_to_avm_accumulated_data.js +2 -2
  26. package/dest/kernel/private_to_public_accumulated_data.js +2 -2
  27. package/dest/kernel/private_to_rollup_accumulated_data.js +1 -1
  28. package/dest/logs/index.d.ts +2 -1
  29. package/dest/logs/index.d.ts.map +1 -1
  30. package/dest/logs/index.js +1 -0
  31. package/dest/logs/private_log.js +1 -1
  32. package/dest/logs/public_log.d.ts +1 -1
  33. package/dest/logs/public_log.d.ts.map +1 -1
  34. package/dest/logs/public_log.js +7 -1
  35. package/dest/logs/tagging_index_range.d.ts +40 -0
  36. package/dest/logs/tagging_index_range.d.ts.map +1 -0
  37. package/dest/logs/tagging_index_range.js +8 -0
  38. package/dest/logs/tx_scoped_l2_log.d.ts +1 -3
  39. package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
  40. package/dest/logs/tx_scoped_l2_log.js +0 -7
  41. package/dest/noir/index.d.ts +3 -3
  42. package/dest/noir/index.d.ts.map +1 -1
  43. package/dest/parity/parity_base_private_inputs.js +1 -1
  44. package/dest/proofs/chonk_proof.d.ts +1 -1
  45. package/dest/proofs/chonk_proof.d.ts.map +1 -1
  46. package/dest/proofs/chonk_proof.js +7 -1
  47. package/dest/rollup/base_rollup_hints.js +2 -2
  48. package/dest/rollup/block_root_rollup_private_inputs.js +5 -5
  49. package/dest/rollup/checkpoint_rollup_public_inputs.js +1 -1
  50. package/dest/rollup/checkpoint_root_rollup_private_inputs.js +3 -3
  51. package/dest/rollup/root_rollup_public_inputs.js +1 -1
  52. package/dest/rollup/tree_snapshot_diff_hints.js +2 -2
  53. package/dest/tx/private_execution_result.d.ts +6 -6
  54. package/dest/tx/private_execution_result.d.ts.map +1 -1
  55. package/dest/tx/private_execution_result.js +6 -6
  56. package/dest/tx/profiling.d.ts +14 -2
  57. package/dest/tx/profiling.d.ts.map +1 -1
  58. package/dest/tx/profiling.js +13 -3
  59. package/dest/tx/protocol_contracts.js +2 -2
  60. package/dest/vks/vk_data.js +1 -1
  61. package/package.json +9 -9
  62. package/src/avm/avm_accumulated_data.ts +6 -6
  63. package/src/avm/avm_circuit_public_inputs.ts +4 -4
  64. package/src/checkpoint/validate.ts +2 -2
  65. package/src/gas/README.md +123 -0
  66. package/src/gas/gas_fees.ts +7 -1
  67. package/src/hash/hash.ts +29 -0
  68. package/src/interfaces/aztec-node.ts +1 -0
  69. package/src/interfaces/block-builder.ts +27 -3
  70. package/src/interfaces/configs.ts +4 -1
  71. package/src/interfaces/world_state.ts +4 -3
  72. package/src/kernel/claimed_length_array.ts +2 -2
  73. package/src/kernel/hints/private_kernel_reset_hints.ts +5 -2
  74. package/src/kernel/hints/read_request_hints.ts +3 -3
  75. package/src/kernel/padded_side_effects.ts +3 -3
  76. package/src/kernel/private_to_avm_accumulated_data.ts +4 -4
  77. package/src/kernel/private_to_public_accumulated_data.ts +10 -10
  78. package/src/kernel/private_to_rollup_accumulated_data.ts +5 -5
  79. package/src/logs/index.ts +1 -0
  80. package/src/logs/private_log.ts +1 -1
  81. package/src/logs/public_log.ts +11 -1
  82. package/src/logs/tagging_index_range.ts +24 -0
  83. package/src/logs/tx_scoped_l2_log.ts +0 -16
  84. package/src/noir/index.ts +2 -2
  85. package/src/parity/parity_base_private_inputs.ts +1 -1
  86. package/src/proofs/chonk_proof.ts +9 -1
  87. package/src/rollup/base_rollup_hints.ts +2 -2
  88. package/src/rollup/block_root_rollup_private_inputs.ts +8 -8
  89. package/src/rollup/checkpoint_rollup_public_inputs.ts +2 -2
  90. package/src/rollup/checkpoint_root_rollup_private_inputs.ts +4 -4
  91. package/src/rollup/root_rollup_public_inputs.ts +2 -2
  92. package/src/rollup/tree_snapshot_diff_hints.ts +5 -5
  93. package/src/tx/private_execution_result.ts +5 -5
  94. package/src/tx/profiling.ts +11 -2
  95. package/src/tx/protocol_contracts.ts +2 -2
  96. package/src/vks/vk_data.ts +1 -1
@@ -73,7 +73,7 @@ export class PrivateToAvmAccumulatedData {
73
73
  return new this(
74
74
  reader.readFieldArray(MAX_NOTE_HASHES_PER_TX),
75
75
  reader.readFieldArray(MAX_NULLIFIERS_PER_TX),
76
- reader.readArray(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
76
+ reader.readTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
77
77
  );
78
78
  }
79
79
 
@@ -94,9 +94,9 @@ export class PrivateToAvmAccumulatedData {
94
94
  static fromBuffer(buffer: Buffer | BufferReader) {
95
95
  const reader = BufferReader.asReader(buffer);
96
96
  return new PrivateToAvmAccumulatedData(
97
- reader.readArray(MAX_NOTE_HASHES_PER_TX, Fr),
98
- reader.readArray(MAX_NULLIFIERS_PER_TX, Fr),
99
- reader.readArray(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
97
+ reader.readTuple(MAX_NOTE_HASHES_PER_TX, Fr),
98
+ reader.readTuple(MAX_NULLIFIERS_PER_TX, Fr),
99
+ reader.readTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
100
100
  );
101
101
  }
102
102
 
@@ -62,10 +62,10 @@ export class PrivateToPublicAccumulatedData {
62
62
  return new this(
63
63
  reader.readFieldArray(MAX_NOTE_HASHES_PER_TX),
64
64
  reader.readFieldArray(MAX_NULLIFIERS_PER_TX),
65
- reader.readArray(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
66
- reader.readArray(MAX_PRIVATE_LOGS_PER_TX, PrivateLog),
67
- reader.readArray(MAX_CONTRACT_CLASS_LOGS_PER_TX, ScopedLogHash),
68
- reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
65
+ reader.readTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
66
+ reader.readTuple(MAX_PRIVATE_LOGS_PER_TX, PrivateLog),
67
+ reader.readTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, ScopedLogHash),
68
+ reader.readTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
69
69
  );
70
70
  }
71
71
 
@@ -76,12 +76,12 @@ export class PrivateToPublicAccumulatedData {
76
76
  static fromBuffer(buffer: Buffer | BufferReader) {
77
77
  const reader = BufferReader.asReader(buffer);
78
78
  return new PrivateToPublicAccumulatedData(
79
- reader.readArray(MAX_NOTE_HASHES_PER_TX, Fr),
80
- reader.readArray(MAX_NULLIFIERS_PER_TX, Fr),
81
- reader.readArray(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
82
- reader.readArray(MAX_PRIVATE_LOGS_PER_TX, PrivateLog),
83
- reader.readArray(MAX_CONTRACT_CLASS_LOGS_PER_TX, ScopedLogHash),
84
- reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
79
+ reader.readTuple(MAX_NOTE_HASHES_PER_TX, Fr),
80
+ reader.readTuple(MAX_NULLIFIERS_PER_TX, Fr),
81
+ reader.readTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
82
+ reader.readTuple(MAX_PRIVATE_LOGS_PER_TX, PrivateLog),
83
+ reader.readTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, ScopedLogHash),
84
+ reader.readTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
85
85
  );
86
86
  }
87
87
 
@@ -95,11 +95,11 @@ export class PrivateToRollupAccumulatedData {
95
95
  static fromBuffer(buffer: Buffer | BufferReader): PrivateToRollupAccumulatedData {
96
96
  const reader = BufferReader.asReader(buffer);
97
97
  return new PrivateToRollupAccumulatedData(
98
- reader.readArray(MAX_NOTE_HASHES_PER_TX, Fr),
99
- reader.readArray(MAX_NULLIFIERS_PER_TX, Fr),
100
- reader.readArray(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
101
- reader.readArray(MAX_PRIVATE_LOGS_PER_TX, PrivateLog),
102
- reader.readArray(MAX_CONTRACT_CLASS_LOGS_PER_TX, ScopedLogHash),
98
+ reader.readTuple(MAX_NOTE_HASHES_PER_TX, Fr),
99
+ reader.readTuple(MAX_NULLIFIERS_PER_TX, Fr),
100
+ reader.readTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
101
+ reader.readTuple(MAX_PRIVATE_LOGS_PER_TX, PrivateLog),
102
+ reader.readTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, ScopedLogHash),
103
103
  );
104
104
  }
105
105
 
package/src/logs/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './extended_directional_app_tagging_secret.js';
2
2
  export * from './pre_tag.js';
3
+ export * from './tagging_index_range.js';
3
4
  export * from './contract_class_log.js';
4
5
  export * from './public_log.js';
5
6
  export * from './private_log.js';
@@ -73,7 +73,7 @@ export class PrivateLog {
73
73
 
74
74
  static fromBuffer(buffer: Buffer | BufferReader) {
75
75
  const reader = BufferReader.asReader(buffer);
76
- return new PrivateLog(reader.readArray(PRIVATE_LOG_SIZE_IN_FIELDS, Fr), reader.readNumber());
76
+ return new PrivateLog(reader.readTuple(PRIVATE_LOG_SIZE_IN_FIELDS, Fr), reader.readNumber());
77
77
  }
78
78
 
79
79
  static random(tag = Fr.random()) {
@@ -1,4 +1,8 @@
1
- import { FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH, PUBLIC_LOG_HEADER_LENGTH } from '@aztec/constants';
1
+ import {
2
+ FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH,
3
+ MAX_PUBLIC_LOG_SIZE_IN_FIELDS,
4
+ PUBLIC_LOG_HEADER_LENGTH,
5
+ } from '@aztec/constants';
2
6
  import type { FieldsOf } from '@aztec/foundation/array';
3
7
  import { Fr } from '@aztec/foundation/curves/bn254';
4
8
  import { type ZodFor, schemas } from '@aztec/foundation/schemas';
@@ -76,6 +80,9 @@ export class FlatPublicLogs {
76
80
  static fromBuffer(buffer: Buffer | BufferReader) {
77
81
  const reader = BufferReader.asReader(buffer);
78
82
  const length = reader.readNumber();
83
+ if (length > FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH) {
84
+ throw new Error(`FlatPublicLogs length ${length} exceeds maximum ${FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH}`);
85
+ }
79
86
  return this.fromUnpaddedPayload(reader.readArray(length, Fr));
80
87
  }
81
88
 
@@ -171,6 +178,9 @@ export class PublicLog {
171
178
  static fromBuffer(buffer: Buffer | BufferReader) {
172
179
  const reader = BufferReader.asReader(buffer);
173
180
  const fieldsLength = reader.readNumber();
181
+ if (fieldsLength > MAX_PUBLIC_LOG_SIZE_IN_FIELDS) {
182
+ throw new Error(`PublicLog fields length ${fieldsLength} exceeds maximum ${MAX_PUBLIC_LOG_SIZE_IN_FIELDS}`);
183
+ }
174
184
  return new PublicLog(reader.readObject(AztecAddress), reader.readArray(fieldsLength, Fr));
175
185
  }
176
186
 
@@ -0,0 +1,24 @@
1
+ import { schemas } from '@aztec/foundation/schemas';
2
+
3
+ import { z } from 'zod';
4
+
5
+ import {
6
+ type ExtendedDirectionalAppTaggingSecret,
7
+ ExtendedDirectionalAppTaggingSecretSchema,
8
+ } from './extended_directional_app_tagging_secret.js';
9
+
10
+ /**
11
+ * Represents a range of tagging indexes for a given extended directional app tagging secret. Used to track the lowest
12
+ * and highest indexes used in a transaction for a given (sender, recipient, app/contract) tuple.
13
+ */
14
+ export type TaggingIndexRange = {
15
+ extendedSecret: ExtendedDirectionalAppTaggingSecret;
16
+ lowestIndex: number;
17
+ highestIndex: number;
18
+ };
19
+
20
+ export const TaggingIndexRangeSchema = z.object({
21
+ extendedSecret: ExtendedDirectionalAppTaggingSecretSchema,
22
+ lowestIndex: schemas.Integer,
23
+ highestIndex: schemas.Integer,
24
+ });
@@ -1,5 +1,4 @@
1
1
  import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types';
2
- import { times } from '@aztec/foundation/collection';
3
2
  import { Fr } from '@aztec/foundation/curves/bn254';
4
3
  import { schemas as foundationSchemas } from '@aztec/foundation/schemas';
5
4
  import {
@@ -84,21 +83,6 @@ export class TxScopedL2Log {
84
83
  return new TxScopedL2Log(txHash, blockNumber, blockTimestamp, logData, noteHashes, firstNullifier);
85
84
  }
86
85
 
87
- static getBlockNumberFromBuffer(buffer: Buffer) {
88
- return BlockNumber(buffer.readUint32BE(Fr.SIZE_IN_BYTES));
89
- }
90
-
91
- static random() {
92
- return new TxScopedL2Log(
93
- TxHash.fromField(Fr.random()),
94
- BlockNumber(Math.floor(Math.random() * 100000) + 1),
95
- BigInt(Math.floor(Date.now() / 1000)),
96
- times(3, Fr.random),
97
- times(3, Fr.random),
98
- Fr.random(),
99
- );
100
- }
101
-
102
86
  equals(other: TxScopedL2Log) {
103
87
  return (
104
88
  this.txHash.equals(other.txHash) &&
package/src/noir/index.ts CHANGED
@@ -19,7 +19,7 @@ export const AZTEC_VIEW_ATTRIBUTE = 'abi_view';
19
19
  export interface NoirFunctionAbi {
20
20
  /** The parameters of the function. */
21
21
  parameters: ABIParameter[];
22
- /** The return type of the function. */
22
+ /** The return type of the function, or null for void functions. */
23
23
  return_type: {
24
24
  /**
25
25
  * The type of the return value.
@@ -29,7 +29,7 @@ export interface NoirFunctionAbi {
29
29
  * The visibility of the return value.
30
30
  */
31
31
  visibility: ABIParameterVisibility;
32
- };
32
+ } | null;
33
33
  /** Mapping of error selector => error type */
34
34
  error_types: Partial<Record<string, AbiErrorType>>;
35
35
  }
@@ -41,7 +41,7 @@ export class ParityBasePrivateInputs {
41
41
  */
42
42
  static fromBuffer(buffer: Buffer | BufferReader) {
43
43
  const reader = BufferReader.asReader(buffer);
44
- return new ParityBasePrivateInputs(reader.readArray(NUM_MSGS_PER_BASE_PARITY, Fr), Fr.fromBuffer(reader));
44
+ return new ParityBasePrivateInputs(reader.readTuple(NUM_MSGS_PER_BASE_PARITY, Fr), Fr.fromBuffer(reader));
45
45
  }
46
46
 
47
47
  /**
@@ -56,7 +56,10 @@ export class ChonkProof {
56
56
  static fromBuffer(buffer: Buffer | BufferReader): ChonkProof {
57
57
  const reader = BufferReader.asReader(buffer);
58
58
  const proofLength = reader.readNumber();
59
- const proof = reader.readArray(proofLength, Fr);
59
+ if (proofLength !== CHONK_PROOF_LENGTH) {
60
+ throw new Error(`Invalid ChonkProof length from buffer: ${proofLength}, expected ${CHONK_PROOF_LENGTH}`);
61
+ }
62
+ const proof = reader.readArray(CHONK_PROOF_LENGTH, Fr);
60
63
  return new ChonkProof(proof);
61
64
  }
62
65
 
@@ -106,6 +109,11 @@ export class ChonkProofWithPublicInputs {
106
109
  static fromBuffer(buffer: Buffer | BufferReader): ChonkProofWithPublicInputs {
107
110
  const reader = BufferReader.asReader(buffer);
108
111
  const proofLength = reader.readNumber();
112
+ if (proofLength < CHONK_PROOF_LENGTH) {
113
+ throw new Error(
114
+ `Invalid ChonkProofWithPublicInputs length from buffer: ${proofLength}, expected at least ${CHONK_PROOF_LENGTH}`,
115
+ );
116
+ }
109
117
  const proof = reader.readArray(proofLength, Fr);
110
118
  return new ChonkProofWithPublicInputs(proof);
111
119
  }
@@ -86,7 +86,7 @@ export class PrivateBaseRollupHints {
86
86
  reader.readObject(SpongeBlob),
87
87
  reader.readObject(TreeSnapshotDiffHints),
88
88
  reader.readObject(PublicDataTreeLeafPreimage),
89
- reader.readArray(ARCHIVE_HEIGHT, Fr),
89
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
90
90
  makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, () => reader.readObject(ContractClassLogFields)),
91
91
  reader.readObject(BlockConstantData),
92
92
  );
@@ -163,7 +163,7 @@ export class PublicBaseRollupHints {
163
163
  return new PublicBaseRollupHints(
164
164
  reader.readObject(SpongeBlob),
165
165
  reader.readObject(AppendOnlyTreeSnapshot),
166
- reader.readArray(ARCHIVE_HEIGHT, Fr),
166
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
167
167
  makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, () => reader.readObject(ContractClassLogFields)),
168
168
  );
169
169
  }
@@ -60,8 +60,8 @@ export class BlockRootFirstRollupPrivateInputs {
60
60
  ProofData.fromBuffer(reader, ParityPublicInputs),
61
61
  [ProofData.fromBuffer(reader, TxRollupPublicInputs), ProofData.fromBuffer(reader, TxRollupPublicInputs)],
62
62
  AppendOnlyTreeSnapshot.fromBuffer(reader),
63
- reader.readArray(L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
64
- reader.readArray(ARCHIVE_HEIGHT, Fr),
63
+ reader.readTuple(L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
64
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
65
65
  );
66
66
  }
67
67
 
@@ -124,8 +124,8 @@ export class BlockRootSingleTxFirstRollupPrivateInputs {
124
124
  ProofData.fromBuffer(reader, ParityPublicInputs),
125
125
  ProofData.fromBuffer(reader, TxRollupPublicInputs),
126
126
  AppendOnlyTreeSnapshot.fromBuffer(reader),
127
- reader.readArray(L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
128
- reader.readArray(ARCHIVE_HEIGHT, Fr),
127
+ reader.readTuple(L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
128
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
129
129
  );
130
130
  }
131
131
 
@@ -206,8 +206,8 @@ export class BlockRootEmptyTxFirstRollupPrivateInputs {
206
206
  StateReference.fromBuffer(reader),
207
207
  CheckpointConstantData.fromBuffer(reader),
208
208
  reader.readUInt64(),
209
- reader.readArray(L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
210
- reader.readArray(ARCHIVE_HEIGHT, Fr),
209
+ reader.readTuple(L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
210
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
211
211
  );
212
212
  }
213
213
 
@@ -248,7 +248,7 @@ export class BlockRootRollupPrivateInputs {
248
248
  const reader = BufferReader.asReader(buffer);
249
249
  return new BlockRootRollupPrivateInputs(
250
250
  [ProofData.fromBuffer(reader, TxRollupPublicInputs), ProofData.fromBuffer(reader, TxRollupPublicInputs)],
251
- reader.readArray(ARCHIVE_HEIGHT, Fr),
251
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
252
252
  );
253
253
  }
254
254
 
@@ -289,7 +289,7 @@ export class BlockRootSingleTxRollupPrivateInputs {
289
289
  const reader = BufferReader.asReader(buffer);
290
290
  return new BlockRootSingleTxRollupPrivateInputs(
291
291
  ProofData.fromBuffer(reader, TxRollupPublicInputs),
292
- reader.readArray(ARCHIVE_HEIGHT, Fr),
292
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
293
293
  );
294
294
  }
295
295
 
@@ -65,8 +65,8 @@ export class CheckpointRollupPublicInputs {
65
65
  reader.readObject(AppendOnlyTreeSnapshot),
66
66
  reader.readObject(AppendOnlyTreeSnapshot),
67
67
  reader.readObject(AppendOnlyTreeSnapshot),
68
- reader.readArray(MAX_CHECKPOINTS_PER_EPOCH, Fr),
69
- reader.readArray(MAX_CHECKPOINTS_PER_EPOCH, FeeRecipient),
68
+ reader.readTuple(MAX_CHECKPOINTS_PER_EPOCH, Fr),
69
+ reader.readTuple(MAX_CHECKPOINTS_PER_EPOCH, FeeRecipient),
70
70
  reader.readObject(BlobAccumulator),
71
71
  reader.readObject(BlobAccumulator),
72
72
  reader.readObject(FinalBlobBatchingChallenges),
@@ -81,15 +81,15 @@ export class CheckpointRootRollupHints {
81
81
  const reader = BufferReader.asReader(buffer);
82
82
  return new CheckpointRootRollupHints(
83
83
  BlockHeader.fromBuffer(reader),
84
- reader.readArray(ARCHIVE_HEIGHT, Fr),
84
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
85
85
  reader.readObject(AppendOnlyTreeSnapshot),
86
- reader.readArray(OUT_HASH_TREE_HEIGHT, Fr),
86
+ reader.readTuple(OUT_HASH_TREE_HEIGHT, Fr),
87
87
  reader.readObject(BlobAccumulator),
88
88
  reader.readObject(FinalBlobBatchingChallenges),
89
89
  // Below line gives error 'Type instantiation is excessively deep and possibly infinite. ts(2589)'
90
- // reader.readArray(FIELDS_PER_BLOB, Fr),
90
+ // reader.readTuple(FIELDS_PER_BLOB, Fr),
91
91
  Array.from({ length: FIELDS_PER_BLOB * BLOBS_PER_CHECKPOINT }, () => Fr.fromBuffer(reader)),
92
- reader.readArray(BLOBS_PER_CHECKPOINT, BLS12Point),
92
+ reader.readTuple(BLOBS_PER_CHECKPOINT, BLS12Point),
93
93
  Fr.fromBuffer(reader),
94
94
  );
95
95
  }
@@ -68,8 +68,8 @@ export class RootRollupPublicInputs {
68
68
  Fr.fromBuffer(reader),
69
69
  Fr.fromBuffer(reader),
70
70
  Fr.fromBuffer(reader),
71
- reader.readArray(MAX_CHECKPOINTS_PER_EPOCH, Fr),
72
- reader.readArray(MAX_CHECKPOINTS_PER_EPOCH, FeeRecipient),
71
+ reader.readTuple(MAX_CHECKPOINTS_PER_EPOCH, Fr),
72
+ reader.readTuple(MAX_CHECKPOINTS_PER_EPOCH, FeeRecipient),
73
73
  EpochConstantData.fromBuffer(reader),
74
74
  reader.readObject(FinalBlobAccumulator),
75
75
  );
@@ -85,14 +85,14 @@ export class TreeSnapshotDiffHints {
85
85
  static fromBuffer(buffer: Buffer | BufferReader): TreeSnapshotDiffHints {
86
86
  const reader = BufferReader.asReader(buffer);
87
87
  return new TreeSnapshotDiffHints(
88
- reader.readArray(NOTE_HASH_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
89
- reader.readArray(MAX_NULLIFIERS_PER_TX, NullifierLeafPreimage),
90
- reader.readArray(MAX_NULLIFIERS_PER_TX, {
88
+ reader.readTuple(NOTE_HASH_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
89
+ reader.readTuple(MAX_NULLIFIERS_PER_TX, NullifierLeafPreimage),
90
+ reader.readTuple(MAX_NULLIFIERS_PER_TX, {
91
91
  fromBuffer: buffer => MembershipWitness.fromBuffer(buffer, NULLIFIER_TREE_HEIGHT),
92
92
  }),
93
- reader.readArray(MAX_NULLIFIERS_PER_TX, Fr),
93
+ reader.readTuple(MAX_NULLIFIERS_PER_TX, Fr),
94
94
  reader.readNumbers(MAX_NULLIFIERS_PER_TX),
95
- reader.readArray(NULLIFIER_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
95
+ reader.readTuple(NULLIFIER_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
96
96
  MembershipWitness.fromBuffer(reader, PUBLIC_DATA_TREE_HEIGHT),
97
97
  );
98
98
  }
@@ -11,7 +11,7 @@ import { PrivateCircuitPublicInputs } from '../kernel/private_circuit_public_inp
11
11
  import type { IsEmpty } from '../kernel/utils/interfaces.js';
12
12
  import { sortByCounter } from '../kernel/utils/order_and_comparison.js';
13
13
  import { ContractClassLog, ContractClassLogFields } from '../logs/contract_class_log.js';
14
- import { type PreTag, PreTagSchema } from '../logs/pre_tag.js';
14
+ import { type TaggingIndexRange, TaggingIndexRangeSchema } from '../logs/tagging_index_range.js';
15
15
  import { Note } from '../note/note.js';
16
16
  import { type ZodFor, mapSchema, schemas } from '../schemas/index.js';
17
17
  import { HashedValues } from './hashed_values.js';
@@ -137,8 +137,8 @@ export class PrivateCallExecutionResult {
137
137
  public returnValues: Fr[],
138
138
  /** The offchain effects emitted during execution of this function call via the `emit_offchain_effect` oracle. */
139
139
  public offchainEffects: { data: Fr[] }[],
140
- /** The pre-tags used in this tx to compute tags for private logs */
141
- public preTags: PreTag[],
140
+ /** The tagging index ranges used in this tx to compute tags for private logs */
141
+ public taggingIndexRanges: TaggingIndexRange[],
142
142
  /** The nested executions. */
143
143
  public nestedExecutionResults: PrivateCallExecutionResult[],
144
144
  /**
@@ -161,7 +161,7 @@ export class PrivateCallExecutionResult {
161
161
  noteHashNullifierCounterMap: mapSchema(z.coerce.number(), z.number()),
162
162
  returnValues: z.array(schemas.Fr),
163
163
  offchainEffects: z.array(z.object({ data: z.array(schemas.Fr) })),
164
- preTags: z.array(PreTagSchema),
164
+ taggingIndexRanges: z.array(TaggingIndexRangeSchema),
165
165
  nestedExecutionResults: z.array(z.lazy(() => PrivateCallExecutionResult.schema)),
166
166
  contractClassLogs: z.array(CountedContractClassLog.schema),
167
167
  })
@@ -178,7 +178,7 @@ export class PrivateCallExecutionResult {
178
178
  fields.noteHashNullifierCounterMap,
179
179
  fields.returnValues,
180
180
  fields.offchainEffects,
181
- fields.preTags,
181
+ fields.taggingIndexRanges,
182
182
  fields.nestedExecutionResults,
183
183
  fields.contractClassLogs,
184
184
  );
@@ -3,6 +3,7 @@ import { type ZodFor, optional, schemas } from '@aztec/foundation/schemas';
3
3
 
4
4
  import { z } from 'zod';
5
5
 
6
+ import { AztecAddress } from '../aztec-address/index.js';
6
7
  import type { AztecNode } from '../interfaces/aztec-node.js';
7
8
  import { type PrivateExecutionStep, PrivateExecutionStepSchema } from '../kernel/private_kernel_prover_output.js';
8
9
 
@@ -160,6 +161,9 @@ export class TxProfileResult {
160
161
  export class UtilityExecutionResult {
161
162
  constructor(
162
163
  public result: Fr[],
164
+ public offchainEffects: { data: Fr[]; contractAddress: AztecAddress }[],
165
+ /** Timestamp of the anchor block used during utility execution. */
166
+ public anchorBlockTimestamp: bigint,
163
167
  public stats?: SimulationStats,
164
168
  ) {}
165
169
 
@@ -167,13 +171,18 @@ export class UtilityExecutionResult {
167
171
  return z
168
172
  .object({
169
173
  result: z.array(schemas.Fr),
174
+ offchainEffects: z.array(z.object({ data: z.array(schemas.Fr), contractAddress: AztecAddress.schema })),
175
+ anchorBlockTimestamp: schemas.BigInt,
170
176
  stats: optional(SimulationStatsSchema),
171
177
  })
172
- .transform(({ result, stats }) => new UtilityExecutionResult(result, stats));
178
+ .transform(
179
+ ({ result, offchainEffects, anchorBlockTimestamp, stats }) =>
180
+ new UtilityExecutionResult(result, offchainEffects, anchorBlockTimestamp, stats),
181
+ );
173
182
  }
174
183
 
175
184
  static random(): UtilityExecutionResult {
176
- return new UtilityExecutionResult([Fr.random()], {
185
+ return new UtilityExecutionResult([Fr.random()], [], 0n, {
177
186
  nodeRPCCalls: {
178
187
  perMethod: { getBlockHeader: { times: [1] } },
179
188
  roundTrips: {
@@ -30,7 +30,7 @@ export class ProtocolContracts {
30
30
 
31
31
  static fromFields(fields: Fr[] | FieldReader): ProtocolContracts {
32
32
  const reader = FieldReader.asReader(fields);
33
- return new ProtocolContracts(reader.readArray(MAX_PROTOCOL_CONTRACTS, AztecAddress));
33
+ return new ProtocolContracts(reader.readTuple(MAX_PROTOCOL_CONTRACTS, AztecAddress));
34
34
  }
35
35
 
36
36
  toFields(): Fr[] {
@@ -39,7 +39,7 @@ export class ProtocolContracts {
39
39
 
40
40
  static fromBuffer(buffer: Buffer | BufferReader): ProtocolContracts {
41
41
  const reader = BufferReader.asReader(buffer);
42
- return new ProtocolContracts(reader.readArray(MAX_PROTOCOL_CONTRACTS, AztecAddress));
42
+ return new ProtocolContracts(reader.readTuple(MAX_PROTOCOL_CONTRACTS, AztecAddress));
43
43
  }
44
44
 
45
45
  toBuffer() {
@@ -29,7 +29,7 @@ export class VkData {
29
29
  return new VkData(
30
30
  reader.readObject(VerificationKeyData),
31
31
  reader.readNumber(),
32
- reader.readArray(VK_TREE_HEIGHT, Fr),
32
+ reader.readTuple(VK_TREE_HEIGHT, Fr),
33
33
  );
34
34
  }
35
35