@aztec/stdlib 0.87.2 → 0.87.3-nightly.20250529

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 (203) hide show
  1. package/dest/abi/abi.d.ts +3 -0
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +38 -0
  4. package/dest/avm/avm.d.ts +696 -12
  5. package/dest/avm/avm.d.ts.map +1 -1
  6. package/dest/avm/avm.js +16 -8
  7. package/dest/avm/avm_accumulated_data.d.ts +77 -0
  8. package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
  9. package/dest/avm/avm_accumulated_data.js +67 -0
  10. package/dest/avm/avm_circuit_public_inputs.d.ts +73 -3
  11. package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
  12. package/dest/avm/avm_circuit_public_inputs.js +19 -9
  13. package/dest/avm/avm_proving_request.d.ts +366 -0
  14. package/dest/avm/avm_proving_request.d.ts.map +1 -1
  15. package/dest/block/body.d.ts +1 -1
  16. package/dest/block/body.d.ts.map +1 -1
  17. package/dest/block/body.js +2 -2
  18. package/dest/block/index.d.ts +1 -0
  19. package/dest/block/index.d.ts.map +1 -1
  20. package/dest/block/index.js +1 -0
  21. package/dest/block/l2_block.d.ts +3 -2
  22. package/dest/block/l2_block.d.ts.map +1 -1
  23. package/dest/block/l2_block.js +10 -5
  24. package/dest/block/l2_block_source.d.ts +9 -4
  25. package/dest/block/l2_block_source.d.ts.map +1 -1
  26. package/dest/block/l2_block_source.js +1 -0
  27. package/dest/block/proposal/committee_attestation.d.ts +34 -0
  28. package/dest/block/proposal/committee_attestation.d.ts.map +1 -0
  29. package/dest/block/proposal/committee_attestation.js +59 -0
  30. package/dest/block/proposal/index.d.ts +2 -0
  31. package/dest/block/proposal/index.d.ts.map +1 -0
  32. package/dest/block/proposal/index.js +1 -0
  33. package/dest/block/published_l2_block.d.ts +99 -69
  34. package/dest/block/published_l2_block.d.ts.map +1 -1
  35. package/dest/block/published_l2_block.js +38 -12
  36. package/dest/block/test/l2_tips_store_test_suite.js +1 -1
  37. package/dest/interfaces/archiver.js +2 -2
  38. package/dest/interfaces/aztec-node.js +2 -2
  39. package/dest/interfaces/p2p.d.ts +5 -2
  40. package/dest/interfaces/p2p.d.ts.map +1 -1
  41. package/dest/interfaces/p2p.js +1 -2
  42. package/dest/interfaces/prover-agent.d.ts +31 -6
  43. package/dest/interfaces/prover-agent.d.ts.map +1 -1
  44. package/dest/interfaces/prover-agent.js +15 -6
  45. package/dest/interfaces/proving-job.d.ts +370 -4
  46. package/dest/interfaces/proving-job.d.ts.map +1 -1
  47. package/dest/interfaces/proving-job.js +2 -2
  48. package/dest/interfaces/server_circuit_prover.d.ts +3 -2
  49. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  50. package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +1 -1
  51. package/dest/kernel/hints/key_validation_hint.d.ts +2 -6
  52. package/dest/kernel/hints/key_validation_hint.d.ts.map +1 -1
  53. package/dest/kernel/hints/key_validation_hint.js +5 -7
  54. package/dest/kernel/hints/private_kernel_reset_hints.d.ts +7 -7
  55. package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
  56. package/dest/kernel/hints/private_kernel_reset_hints.js +8 -4
  57. package/dest/kernel/hints/read_request_hints.d.ts +8 -8
  58. package/dest/kernel/hints/read_request_hints.d.ts.map +1 -1
  59. package/dest/kernel/index.d.ts +1 -0
  60. package/dest/kernel/index.d.ts.map +1 -1
  61. package/dest/kernel/index.js +1 -0
  62. package/dest/kernel/padded_side_effects.d.ts +26 -0
  63. package/dest/kernel/padded_side_effects.d.ts.map +1 -0
  64. package/dest/kernel/padded_side_effects.js +51 -0
  65. package/dest/kernel/private_kernel_data.d.ts +6 -25
  66. package/dest/kernel/private_kernel_data.d.ts.map +1 -1
  67. package/dest/kernel/private_kernel_data.js +8 -19
  68. package/dest/kernel/private_kernel_prover_output.d.ts +3 -0
  69. package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
  70. package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts +7 -4
  71. package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts.map +1 -1
  72. package/dest/kernel/private_kernel_reset_circuit_private_inputs.js +10 -6
  73. package/dest/kernel/private_kernel_reset_dimensions.d.ts +10 -10
  74. package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
  75. package/dest/kernel/private_kernel_reset_dimensions.js +29 -29
  76. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +10 -1
  77. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
  78. package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +8 -3
  79. package/dest/kernel/public_call_request.d.ts +54 -0
  80. package/dest/kernel/public_call_request.d.ts.map +1 -1
  81. package/dest/kernel/public_call_request.js +58 -0
  82. package/dest/logs/contract_class_log.d.ts +0 -4
  83. package/dest/logs/contract_class_log.d.ts.map +1 -1
  84. package/dest/logs/contract_class_log.js +0 -33
  85. package/dest/logs/log_with_tx_data.d.ts +3 -3
  86. package/dest/logs/log_with_tx_data.d.ts.map +1 -1
  87. package/dest/logs/log_with_tx_data.js +9 -13
  88. package/dest/logs/pending_tagged_log.d.ts +1 -1
  89. package/dest/logs/pending_tagged_log.js +1 -1
  90. package/dest/logs/private_log.d.ts +1 -0
  91. package/dest/logs/private_log.d.ts.map +1 -1
  92. package/dest/logs/private_log.js +3 -0
  93. package/dest/logs/public_log.d.ts +1 -0
  94. package/dest/logs/public_log.d.ts.map +1 -1
  95. package/dest/logs/public_log.js +3 -0
  96. package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
  97. package/dest/logs/tx_scoped_l2_log.js +1 -0
  98. package/dest/rollup/avm_proof_data.d.ts +7 -5
  99. package/dest/rollup/avm_proof_data.d.ts.map +1 -1
  100. package/dest/rollup/avm_proof_data.js +12 -4
  101. package/dest/rollup/base_rollup_hints.d.ts +4 -4
  102. package/dest/rollup/base_rollup_hints.d.ts.map +1 -1
  103. package/dest/rollup/base_rollup_hints.js +8 -8
  104. package/dest/rollup/previous_rollup_block_data.d.ts +6 -15
  105. package/dest/rollup/previous_rollup_block_data.d.ts.map +1 -1
  106. package/dest/rollup/previous_rollup_block_data.js +8 -13
  107. package/dest/rollup/previous_rollup_data.d.ts +6 -15
  108. package/dest/rollup/previous_rollup_data.d.ts.map +1 -1
  109. package/dest/rollup/previous_rollup_data.js +8 -13
  110. package/dest/rollup/private_tube_data.d.ts +3 -3
  111. package/dest/rollup/private_tube_data.d.ts.map +1 -1
  112. package/dest/rollup/private_tube_data.js +3 -3
  113. package/dest/rollup/public_tube_data.d.ts +3 -3
  114. package/dest/rollup/public_tube_data.d.ts.map +1 -1
  115. package/dest/rollup/public_tube_data.js +3 -3
  116. package/dest/rollup/root_rollup.d.ts +9 -10
  117. package/dest/rollup/root_rollup.d.ts.map +1 -1
  118. package/dest/rollup/root_rollup.js +9 -20
  119. package/dest/tests/factories.d.ts +2 -1
  120. package/dest/tests/factories.d.ts.map +1 -1
  121. package/dest/tests/factories.js +25 -19
  122. package/dest/tests/mocks.d.ts.map +1 -1
  123. package/dest/tests/mocks.js +4 -3
  124. package/dest/tx/private_execution_result.d.ts +6 -0
  125. package/dest/tx/private_execution_result.d.ts.map +1 -1
  126. package/dest/tx/processed_tx.d.ts.map +1 -1
  127. package/dest/tx/processed_tx.js +2 -5
  128. package/dest/tx/profiling.d.ts +41 -0
  129. package/dest/tx/profiling.d.ts.map +1 -1
  130. package/dest/tx/profiling.js +4 -1
  131. package/dest/tx/proven_tx.d.ts +40 -18
  132. package/dest/tx/proven_tx.d.ts.map +1 -1
  133. package/dest/tx/proven_tx.js +2 -2
  134. package/dest/tx/tx.d.ts +10 -25
  135. package/dest/tx/tx.d.ts.map +1 -1
  136. package/dest/tx/tx.js +25 -50
  137. package/dest/tx/tx_effect.d.ts +1 -1
  138. package/dest/tx/tx_effect.d.ts.map +1 -1
  139. package/dest/tx/tx_effect.js +2 -2
  140. package/dest/validators/types.d.ts +4 -0
  141. package/dest/validators/types.d.ts.map +1 -1
  142. package/dest/vks/index.d.ts +1 -1
  143. package/dest/vks/index.d.ts.map +1 -1
  144. package/dest/vks/index.js +1 -1
  145. package/dest/vks/{vk_witness_data.d.ts → vk_data.d.ts} +8 -8
  146. package/dest/vks/vk_data.d.ts.map +1 -0
  147. package/dest/vks/{vk_witness_data.js → vk_data.js} +10 -10
  148. package/package.json +7 -7
  149. package/src/abi/abi.ts +37 -0
  150. package/src/avm/avm.ts +14 -0
  151. package/src/avm/avm_accumulated_data.ts +93 -0
  152. package/src/avm/avm_circuit_public_inputs.ts +22 -2
  153. package/src/block/body.ts +7 -2
  154. package/src/block/index.ts +1 -0
  155. package/src/block/l2_block.ts +8 -3
  156. package/src/block/l2_block_source.ts +9 -3
  157. package/src/block/proposal/committee_attestation.ts +70 -0
  158. package/src/block/proposal/index.ts +1 -0
  159. package/src/block/published_l2_block.ts +38 -24
  160. package/src/block/test/l2_tips_store_test_suite.ts +1 -1
  161. package/src/interfaces/archiver.ts +2 -2
  162. package/src/interfaces/aztec-node.ts +2 -2
  163. package/src/interfaces/p2p.ts +8 -3
  164. package/src/interfaces/prover-agent.ts +9 -10
  165. package/src/interfaces/proving-job.ts +3 -3
  166. package/src/interfaces/server_circuit_prover.ts +3 -2
  167. package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +3 -3
  168. package/src/kernel/hints/key_validation_hint.ts +4 -6
  169. package/src/kernel/hints/private_kernel_reset_hints.ts +34 -43
  170. package/src/kernel/hints/read_request_hints.ts +27 -15
  171. package/src/kernel/index.ts +1 -0
  172. package/src/kernel/padded_side_effects.ts +73 -0
  173. package/src/kernel/private_kernel_data.ts +7 -29
  174. package/src/kernel/private_kernel_prover_output.ts +1 -0
  175. package/src/kernel/private_kernel_reset_circuit_private_inputs.ts +16 -13
  176. package/src/kernel/private_kernel_reset_dimensions.ts +27 -27
  177. package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +10 -2
  178. package/src/kernel/public_call_request.ts +66 -0
  179. package/src/logs/contract_class_log.ts +0 -36
  180. package/src/logs/log_with_tx_data.ts +7 -11
  181. package/src/logs/pending_tagged_log.ts +1 -1
  182. package/src/logs/private_log.ts +4 -0
  183. package/src/logs/public_log.ts +4 -0
  184. package/src/logs/tx_scoped_l2_log.ts +1 -0
  185. package/src/rollup/avm_proof_data.ts +14 -7
  186. package/src/rollup/base_rollup_hints.ts +4 -4
  187. package/src/rollup/previous_rollup_block_data.ts +6 -12
  188. package/src/rollup/previous_rollup_data.ts +6 -12
  189. package/src/rollup/private_tube_data.ts +4 -4
  190. package/src/rollup/public_tube_data.ts +4 -4
  191. package/src/rollup/root_rollup.ts +6 -19
  192. package/src/tests/factories.ts +36 -32
  193. package/src/tests/mocks.ts +6 -3
  194. package/src/tx/private_execution_result.ts +1 -1
  195. package/src/tx/processed_tx.ts +4 -5
  196. package/src/tx/profiling.ts +6 -1
  197. package/src/tx/proven_tx.ts +2 -2
  198. package/src/tx/tx.ts +28 -54
  199. package/src/tx/tx_effect.ts +23 -5
  200. package/src/validators/types.ts +2 -0
  201. package/src/vks/index.ts +1 -1
  202. package/src/vks/{vk_witness_data.ts → vk_data.ts} +6 -6
  203. package/dest/vks/vk_witness_data.d.ts.map +0 -1
@@ -14,10 +14,10 @@ import {
14
14
  PrivateToAvmAccumulatedData,
15
15
  PrivateToAvmAccumulatedDataArrayLengths,
16
16
  } from '../kernel/private_to_avm_accumulated_data.js';
17
- import { PublicCallRequest } from '../kernel/public_call_request.js';
17
+ import { PublicCallRequest, PublicCallRequestArrayLengths } from '../kernel/public_call_request.js';
18
18
  import { GlobalVariables } from '../tx/global_variables.js';
19
19
  import { TreeSnapshots } from '../tx/tree_snapshots.js';
20
- import { AvmAccumulatedData } from './avm_accumulated_data.js';
20
+ import { AvmAccumulatedData, AvmAccumulatedDataArrayLengths } from './avm_accumulated_data.js';
21
21
  import { serializeWithMessagePack } from './message_pack.js';
22
22
 
23
23
  // Note: the {from,to}{Buffer,Fields,String} methods are needed by AvmProofData and PublicBaseRollupInputs.
@@ -31,6 +31,7 @@ export class AvmCircuitPublicInputs {
31
31
  public startGasUsed: Gas,
32
32
  public gasSettings: GasSettings,
33
33
  public feePayer: AztecAddress,
34
+ public publicCallRequestArrayLengths: PublicCallRequestArrayLengths,
34
35
  public publicSetupCallRequests: Tuple<PublicCallRequest, typeof MAX_ENQUEUED_CALLS_PER_TX>,
35
36
  public publicAppLogicCallRequests: Tuple<PublicCallRequest, typeof MAX_ENQUEUED_CALLS_PER_TX>,
36
37
  public publicTeardownCallRequest: PublicCallRequest,
@@ -42,6 +43,7 @@ export class AvmCircuitPublicInputs {
42
43
  // Outputs.
43
44
  public endTreeSnapshots: TreeSnapshots,
44
45
  public endGasUsed: Gas,
46
+ public accumulatedDataArrayLengths: AvmAccumulatedDataArrayLengths,
45
47
  public accumulatedData: AvmAccumulatedData,
46
48
  public transactionFee: Fr,
47
49
  public reverted: boolean,
@@ -55,6 +57,7 @@ export class AvmCircuitPublicInputs {
55
57
  startGasUsed: Gas.schema,
56
58
  gasSettings: GasSettings.schema,
57
59
  feePayer: AztecAddress.schema,
60
+ publicCallRequestArrayLengths: PublicCallRequestArrayLengths.schema,
58
61
  publicSetupCallRequests: PublicCallRequest.schema.array().max(MAX_ENQUEUED_CALLS_PER_TX),
59
62
  publicAppLogicCallRequests: PublicCallRequest.schema.array().max(MAX_ENQUEUED_CALLS_PER_TX),
60
63
  publicTeardownCallRequest: PublicCallRequest.schema,
@@ -64,6 +67,7 @@ export class AvmCircuitPublicInputs {
64
67
  previousRevertibleAccumulatedData: PrivateToAvmAccumulatedData.schema,
65
68
  endTreeSnapshots: TreeSnapshots.schema,
66
69
  endGasUsed: Gas.schema,
70
+ accumulatedDataArrayLengths: AvmAccumulatedDataArrayLengths.schema,
67
71
  accumulatedData: AvmAccumulatedData.schema,
68
72
  transactionFee: schemas.Fr,
69
73
  reverted: z.boolean(),
@@ -75,6 +79,7 @@ export class AvmCircuitPublicInputs {
75
79
  startGasUsed,
76
80
  gasSettings,
77
81
  feePayer,
82
+ publicCallRequestArrayLengths,
78
83
  publicSetupCallRequests,
79
84
  publicAppLogicCallRequests,
80
85
  publicTeardownCallRequest,
@@ -84,6 +89,7 @@ export class AvmCircuitPublicInputs {
84
89
  previousRevertibleAccumulatedData,
85
90
  endTreeSnapshots,
86
91
  endGasUsed,
92
+ accumulatedDataArrayLengths,
87
93
  accumulatedData,
88
94
  transactionFee,
89
95
  reverted,
@@ -94,6 +100,7 @@ export class AvmCircuitPublicInputs {
94
100
  startGasUsed,
95
101
  gasSettings,
96
102
  feePayer,
103
+ publicCallRequestArrayLengths,
97
104
  assertLength(publicSetupCallRequests, MAX_ENQUEUED_CALLS_PER_TX),
98
105
  assertLength(publicAppLogicCallRequests, MAX_ENQUEUED_CALLS_PER_TX),
99
106
  publicTeardownCallRequest,
@@ -103,6 +110,7 @@ export class AvmCircuitPublicInputs {
103
110
  previousRevertibleAccumulatedData,
104
111
  endTreeSnapshots,
105
112
  endGasUsed,
113
+ accumulatedDataArrayLengths,
106
114
  accumulatedData,
107
115
  transactionFee,
108
116
  reverted,
@@ -118,6 +126,7 @@ export class AvmCircuitPublicInputs {
118
126
  reader.readObject(Gas),
119
127
  reader.readObject(GasSettings),
120
128
  reader.readObject(AztecAddress),
129
+ reader.readObject(PublicCallRequestArrayLengths),
121
130
  reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
122
131
  reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
123
132
  reader.readObject(PublicCallRequest),
@@ -127,6 +136,7 @@ export class AvmCircuitPublicInputs {
127
136
  reader.readObject(PrivateToAvmAccumulatedData),
128
137
  reader.readObject(TreeSnapshots),
129
138
  reader.readObject(Gas),
139
+ reader.readObject(AvmAccumulatedDataArrayLengths),
130
140
  reader.readObject(AvmAccumulatedData),
131
141
  reader.readObject(Fr),
132
142
  reader.readBoolean(),
@@ -140,6 +150,7 @@ export class AvmCircuitPublicInputs {
140
150
  this.startGasUsed,
141
151
  this.gasSettings,
142
152
  this.feePayer,
153
+ this.publicCallRequestArrayLengths,
143
154
  this.publicSetupCallRequests,
144
155
  this.publicAppLogicCallRequests,
145
156
  this.publicTeardownCallRequest,
@@ -149,6 +160,7 @@ export class AvmCircuitPublicInputs {
149
160
  this.previousRevertibleAccumulatedData,
150
161
  this.endTreeSnapshots,
151
162
  this.endGasUsed,
163
+ this.accumulatedDataArrayLengths,
152
164
  this.accumulatedData,
153
165
  this.transactionFee,
154
166
  this.reverted,
@@ -171,6 +183,7 @@ export class AvmCircuitPublicInputs {
171
183
  Gas.fromFields(reader),
172
184
  GasSettings.fromFields(reader),
173
185
  AztecAddress.fromFields(reader),
186
+ PublicCallRequestArrayLengths.fromFields(reader),
174
187
  reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
175
188
  reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
176
189
  PublicCallRequest.fromFields(reader),
@@ -180,6 +193,7 @@ export class AvmCircuitPublicInputs {
180
193
  PrivateToAvmAccumulatedData.fromFields(reader),
181
194
  TreeSnapshots.fromFields(reader),
182
195
  Gas.fromFields(reader),
196
+ AvmAccumulatedDataArrayLengths.fromFields(reader),
183
197
  AvmAccumulatedData.fromFields(reader),
184
198
  reader.readField(),
185
199
  reader.readBoolean(),
@@ -193,6 +207,7 @@ export class AvmCircuitPublicInputs {
193
207
  ...this.startGasUsed.toFields(),
194
208
  ...this.gasSettings.toFields(),
195
209
  this.feePayer,
210
+ ...this.publicCallRequestArrayLengths.toFields(),
196
211
  ...this.publicSetupCallRequests.map(request => request.toFields()),
197
212
  ...this.publicAppLogicCallRequests.map(request => request.toFields()),
198
213
  ...this.publicTeardownCallRequest.toFields(),
@@ -202,6 +217,7 @@ export class AvmCircuitPublicInputs {
202
217
  ...this.previousRevertibleAccumulatedData.toFields(),
203
218
  ...this.endTreeSnapshots.toFields(),
204
219
  ...this.endGasUsed.toFields(),
220
+ ...this.accumulatedDataArrayLengths.toFields(),
205
221
  ...this.accumulatedData.toFields(),
206
222
  this.transactionFee,
207
223
  this.reverted,
@@ -215,6 +231,7 @@ export class AvmCircuitPublicInputs {
215
231
  Gas.empty(),
216
232
  GasSettings.empty(),
217
233
  AztecAddress.zero(),
234
+ PublicCallRequestArrayLengths.empty(),
218
235
  makeTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest.empty),
219
236
  makeTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest.empty),
220
237
  PublicCallRequest.empty(),
@@ -224,6 +241,7 @@ export class AvmCircuitPublicInputs {
224
241
  PrivateToAvmAccumulatedData.empty(),
225
242
  TreeSnapshots.empty(),
226
243
  Gas.empty(),
244
+ AvmAccumulatedDataArrayLengths.empty(),
227
245
  AvmAccumulatedData.empty(),
228
246
  Fr.zero(),
229
247
  false,
@@ -241,6 +259,7 @@ export class AvmCircuitPublicInputs {
241
259
  startGasUsed: ${inspect(this.startGasUsed)},
242
260
  gasSettings: ${inspect(this.gasSettings)},
243
261
  feePayer: ${inspect(this.feePayer)},
262
+ publicCallRequestArrayLengths: ${inspect(this.publicCallRequestArrayLengths)},
244
263
  publicSetupCallRequests: [${this.publicSetupCallRequests
245
264
  .filter(x => !x.isEmpty())
246
265
  .map(h => inspect(h))
@@ -258,6 +277,7 @@ export class AvmCircuitPublicInputs {
258
277
  previousRevertibleAccumulatedData: ${inspect(this.previousRevertibleAccumulatedData)},
259
278
  endTreeSnapshots: ${inspect(this.endTreeSnapshots)},
260
279
  endGasUsed: ${inspect(this.endGasUsed)},
280
+ accumulatedDataArrayLengths: ${inspect(this.accumulatedDataArrayLengths)},
261
281
  accumulatedData: ${inspect(this.accumulatedData)},
262
282
  transactionFee: ${inspect(this.transactionFee)},
263
283
  reverted: ${this.reverted},
package/src/block/body.ts CHANGED
@@ -87,9 +87,14 @@ export class Body {
87
87
  }`;
88
88
  }
89
89
 
90
- static async random(txsPerBlock = 4, numPublicCallsPerTx = 3, numPublicLogsPerCall = 1) {
90
+ static async random(
91
+ txsPerBlock = 4,
92
+ numPublicCallsPerTx = 3,
93
+ numPublicLogsPerCall = 1,
94
+ maxEffects: number | undefined = undefined,
95
+ ) {
91
96
  const txEffects = await timesParallel(txsPerBlock, () =>
92
- TxEffect.random(numPublicCallsPerTx, numPublicLogsPerCall),
97
+ TxEffect.random(numPublicCallsPerTx, numPublicLogsPerCall, maxEffects),
93
98
  );
94
99
 
95
100
  return new Body(txEffects);
@@ -6,3 +6,4 @@ export * from './l2_block_number.js';
6
6
  export * from './l2_block_source.js';
7
7
  export * from './block_hash.js';
8
8
  export * from './published_l2_block.js';
9
+ export * from './proposal/index.js';
@@ -20,6 +20,7 @@ export class L2Block {
20
20
  public header: BlockHeader,
21
21
  /** L2 block body. */
22
22
  public body: Body,
23
+ private blockHash: Fr | undefined = undefined,
23
24
  ) {}
24
25
 
25
26
  static get schema() {
@@ -86,8 +87,9 @@ export class L2Block {
86
87
  numPublicLogsPerCall = 1,
87
88
  inHash: Buffer | undefined = undefined,
88
89
  slotNumber: number | undefined = undefined,
90
+ maxEffects: number | undefined = undefined,
89
91
  ): Promise<L2Block> {
90
- const body = await Body.random(txsPerBlock, numPublicCallsPerTx, numPublicLogsPerCall);
92
+ const body = await Body.random(txsPerBlock, numPublicCallsPerTx, numPublicLogsPerCall, maxEffects);
91
93
 
92
94
  return new L2Block(
93
95
  makeAppendOnlyTreeSnapshot(l2BlockNum + 1),
@@ -112,8 +114,11 @@ export class L2Block {
112
114
  * Returns the block's hash (hash of block header).
113
115
  * @returns The block's hash.
114
116
  */
115
- public hash(): Promise<Fr> {
116
- return this.header.hash();
117
+ public async hash(): Promise<Fr> {
118
+ if (this.blockHash === undefined) {
119
+ this.blockHash = await this.header.hash();
120
+ }
121
+ return this.blockHash;
117
122
  }
118
123
 
119
124
  /**
@@ -1,6 +1,6 @@
1
1
  import type { EthAddress } from '@aztec/foundation/eth-address';
2
+ import type { TypedEventEmitter } from '@aztec/foundation/types';
2
3
 
3
- import type { EventEmitter } from 'events';
4
4
  import { z } from 'zod';
5
5
 
6
6
  import type { L1RollupConstants } from '../epoch-helpers/index.js';
@@ -127,7 +127,12 @@ export interface L2BlockSource {
127
127
  * L2BlockSource that emits events upon pending / proven chain changes.
128
128
  * see L2BlockSourceEvents for the events emitted.
129
129
  */
130
- export interface L2BlockSourceEventEmitter extends L2BlockSource, EventEmitter {}
130
+
131
+ export type ArchiverEmitter = TypedEventEmitter<{
132
+ [L2BlockSourceEvents.L2PruneDetected]: (args: L2BlockSourceEvent) => void;
133
+ [L2BlockSourceEvents.L2BlockProven]: (args: L2BlockSourceEvent) => void;
134
+ }>;
135
+ export interface L2BlockSourceEventEmitter extends L2BlockSource, ArchiverEmitter {}
131
136
 
132
137
  /**
133
138
  * Identifier for L2 block tags.
@@ -171,10 +176,11 @@ export const L2TipsSchema = z.object({
171
176
 
172
177
  export enum L2BlockSourceEvents {
173
178
  L2PruneDetected = 'l2PruneDetected',
179
+ L2BlockProven = 'l2BlockProven',
174
180
  }
175
181
 
176
182
  export type L2BlockSourceEvent = {
177
- type: 'l2PruneDetected';
183
+ type: 'l2PruneDetected' | 'l2BlockProven';
178
184
  blockNumber: bigint;
179
185
  slotNumber: bigint;
180
186
  epochNumber: bigint;
@@ -0,0 +1,70 @@
1
+ import type { ViemCommitteeAttestation } from '@aztec/ethereum';
2
+ import { EthAddress } from '@aztec/foundation/eth-address';
3
+ import { Signature } from '@aztec/foundation/eth-signature';
4
+ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
5
+
6
+ import { z } from 'zod';
7
+
8
+ export { Signature };
9
+ export { EthAddress };
10
+
11
+ export class CommitteeAttestation {
12
+ constructor(
13
+ public readonly address: EthAddress,
14
+ public readonly signature: Signature,
15
+ ) {}
16
+
17
+ static get schema() {
18
+ return z
19
+ .object({
20
+ address: EthAddress.schema,
21
+ signature: Signature.schema,
22
+ })
23
+ .transform(({ address, signature }) => new CommitteeAttestation(address, signature));
24
+ }
25
+
26
+ // Create an empty attestation for an address that has not signed
27
+ static fromAddress(address: EthAddress): CommitteeAttestation {
28
+ return new CommitteeAttestation(address, Signature.empty());
29
+ }
30
+
31
+ // Create an attestation from an address and a signature
32
+ static fromAddressAndSignature(address: EthAddress, signature: Signature): CommitteeAttestation {
33
+ return new CommitteeAttestation(address, signature);
34
+ }
35
+
36
+ static fromViem(viem: ViemCommitteeAttestation): CommitteeAttestation {
37
+ return new CommitteeAttestation(EthAddress.fromString(viem.addr), Signature.fromViemSignature(viem.signature));
38
+ }
39
+
40
+ static fromBuffer(buffer: Buffer): CommitteeAttestation {
41
+ const reader = BufferReader.asReader(buffer);
42
+ const address = reader.readObject(EthAddress);
43
+ const signature = reader.readObject(Signature);
44
+ return new CommitteeAttestation(address, signature);
45
+ }
46
+
47
+ static random(): CommitteeAttestation {
48
+ // note: will be invalid
49
+ return new CommitteeAttestation(EthAddress.random(), Signature.random());
50
+ }
51
+
52
+ static empty(): CommitteeAttestation {
53
+ return new CommitteeAttestation(EthAddress.ZERO, Signature.empty());
54
+ }
55
+
56
+ toBuffer(): Buffer {
57
+ return serializeToBuffer([this.address, this.signature]);
58
+ }
59
+
60
+ equals(other: CommitteeAttestation): boolean {
61
+ return this.address.equals(other.address) && this.signature.equals(other.signature);
62
+ }
63
+
64
+ toViem(): ViemCommitteeAttestation {
65
+ return {
66
+ addr: this.address.toString(),
67
+ signature: this.signature.toViemSignature(),
68
+ };
69
+ }
70
+ }
@@ -0,0 +1 @@
1
+ export * from './committee_attestation.js';
@@ -1,37 +1,51 @@
1
- import { Signature } from '@aztec/foundation/eth-signature';
1
+ // Ignoring import issue to fix portable inferred type issue in zod schema
2
2
  import { schemas } from '@aztec/foundation/schemas';
3
- import { L2Block } from '@aztec/stdlib/block';
4
3
 
5
4
  import { z } from 'zod';
6
5
 
7
6
  import { BlockAttestation } from '../p2p/block_attestation.js';
8
7
  import { ConsensusPayload } from '../p2p/consensus_payload.js';
8
+ import { L2Block } from './l2_block.js';
9
+ import { CommitteeAttestation } from './proposal/committee_attestation.js';
9
10
 
10
- export type L1PublishedData = {
11
- blockNumber: bigint;
12
- timestamp: bigint;
13
- blockHash: string;
14
- };
11
+ export class L1PublishedData {
12
+ constructor(
13
+ public blockNumber: bigint,
14
+ public timestamp: bigint,
15
+ public blockHash: string,
16
+ ) {}
15
17
 
16
- export type PublishedL2Block = {
17
- block: L2Block;
18
- l1: L1PublishedData;
19
- signatures: Signature[];
20
- };
18
+ static get schema() {
19
+ return z.object({
20
+ blockNumber: schemas.BigInt,
21
+ timestamp: schemas.BigInt,
22
+ blockHash: z.string(),
23
+ });
24
+ }
25
+ }
26
+
27
+ export class PublishedL2Block {
28
+ constructor(
29
+ public block: L2Block,
30
+ public l1: L1PublishedData,
31
+ public attestations: CommitteeAttestation[],
32
+ ) {}
21
33
 
22
- export const PublishedL2BlockSchema = z.object({
23
- block: L2Block.schema,
24
- l1: z.object({
25
- blockNumber: schemas.BigInt,
26
- timestamp: schemas.BigInt,
27
- blockHash: z.string(),
28
- }),
29
- signatures: z.array(Signature.schema),
30
- });
34
+ static get schema() {
35
+ return z.object({
36
+ block: L2Block.schema,
37
+ l1: L1PublishedData.schema,
38
+ attestations: z.array(CommitteeAttestation.schema),
39
+ });
40
+ }
41
+ }
31
42
 
32
43
  export function getAttestationsFromPublishedL2Block(block: PublishedL2Block) {
33
44
  const payload = ConsensusPayload.fromBlock(block.block);
34
- return block.signatures
35
- .filter(sig => !sig.isEmpty)
36
- .map(signature => new BlockAttestation(block.block.header.globalVariables.blockNumber, payload, signature));
45
+ return block.attestations
46
+ .filter(attestation => !attestation.signature.isEmpty())
47
+ .map(
48
+ attestation =>
49
+ new BlockAttestation(block.block.header.globalVariables.blockNumber, payload, attestation.signature),
50
+ );
37
51
  }
@@ -17,7 +17,7 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
17
17
  const makeBlock = (number: number): PublishedL2Block => ({
18
18
  block: { number, header: { hash: () => Promise.resolve(new Fr(number)) } as BlockHeader } as L2Block,
19
19
  l1: { blockNumber: BigInt(number), blockHash: `0x${number}`, timestamp: BigInt(number) },
20
- signatures: [],
20
+ attestations: [],
21
21
  });
22
22
 
23
23
  const makeBlockId = (number: number): L2BlockId => ({
@@ -4,7 +4,7 @@ import { z } from 'zod';
4
4
 
5
5
  import { L2Block } from '../block/l2_block.js';
6
6
  import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
7
- import { PublishedL2BlockSchema } from '../block/published_l2_block.js';
7
+ import { PublishedL2Block } from '../block/published_l2_block.js';
8
8
  import {
9
9
  ContractClassPublicSchema,
10
10
  type ContractDataSource,
@@ -45,7 +45,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
45
45
  getPublishedBlocks: z
46
46
  .function()
47
47
  .args(schemas.Integer, schemas.Integer, optional(z.boolean()))
48
- .returns(z.array(PublishedL2BlockSchema)),
48
+ .returns(z.array(PublishedL2Block.schema)),
49
49
  getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
50
50
  getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
51
51
  getL2SlotNumber: z.function().args().returns(schemas.BigInt),
@@ -17,7 +17,7 @@ import { type InBlock, inBlockSchemaFor } from '../block/in_block.js';
17
17
  import { L2Block } from '../block/l2_block.js';
18
18
  import { type L2BlockNumber, L2BlockNumberSchema } from '../block/l2_block_number.js';
19
19
  import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
20
- import { PublishedL2BlockSchema } from '../block/published_l2_block.js';
20
+ import { PublishedL2Block } from '../block/published_l2_block.js';
21
21
  import {
22
22
  type ContractClassPublic,
23
23
  ContractClassPublicSchema,
@@ -484,7 +484,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
484
484
 
485
485
  getBlocks: z.function().args(z.number(), z.number()).returns(z.array(L2Block.schema)),
486
486
 
487
- getPublishedBlocks: z.function().args(z.number(), z.number()).returns(z.array(PublishedL2BlockSchema)),
487
+ getPublishedBlocks: z.function().args(z.number(), z.number()).returns(z.array(PublishedL2Block.schema)),
488
488
 
489
489
  getCurrentBaseFees: z.function().returns(GasFees.schema),
490
490
 
@@ -44,7 +44,7 @@ export interface P2PApiWithoutAttestations {
44
44
  getPeers(includePending?: boolean): Promise<PeerInfo[]>;
45
45
  }
46
46
 
47
- export interface P2PClient extends P2PApiWithoutAttestations {
47
+ export interface P2PApiWithAttestations extends P2PApiWithoutAttestations {
48
48
  /**
49
49
  * Queries the Attestation pool for attestations for the given slot
50
50
  *
@@ -53,13 +53,19 @@ export interface P2PClient extends P2PApiWithoutAttestations {
53
53
  * @returns BlockAttestations
54
54
  */
55
55
  getAttestationsForSlot(slot: bigint, proposalId?: string): Promise<BlockAttestation[]>;
56
+ }
56
57
 
58
+ export interface P2PClient extends P2PApiWithAttestations {
57
59
  /** Manually adds an attestation to the p2p client attestation pool. */
58
60
  addAttestation(attestation: BlockAttestation): Promise<void>;
59
61
  }
60
62
 
61
63
  export type P2PApi<T extends P2PClientType = P2PClientType.Full> = T extends P2PClientType.Full
62
- ? P2PClient & P2PApiWithoutAttestations
64
+ ? P2PApiWithAttestations
65
+ : P2PApiWithoutAttestations;
66
+
67
+ export type P2PApiFull<T extends P2PClientType = P2PClientType.Full> = T extends P2PClientType.Full
68
+ ? P2PApiWithAttestations & P2PClient
63
69
  : P2PApiWithoutAttestations;
64
70
 
65
71
  export const P2PApiSchema: ApiSchemaFor<P2PApi> = {
@@ -71,5 +77,4 @@ export const P2PApiSchema: ApiSchemaFor<P2PApi> = {
71
77
  getPendingTxCount: z.function().returns(schemas.Integer),
72
78
  getEncodedEnr: z.function().returns(z.string().optional()),
73
79
  getPeers: z.function().args(optional(z.boolean())).returns(z.array(PeerInfoSchema)),
74
- addAttestation: z.function().args(BlockAttestation.schema).returns(z.void()),
75
80
  };
@@ -2,19 +2,18 @@ import { z } from 'zod';
2
2
 
3
3
  import type { ApiSchemaFor } from '../schemas/index.js';
4
4
 
5
- export interface ProverAgentApi {
6
- setMaxConcurrency(maxConcurrency: number): Promise<void>;
5
+ export const ProverAgentStatusSchema = z.discriminatedUnion('status', [
6
+ z.object({ status: z.literal('stopped') }),
7
+ z.object({ status: z.literal('running') }),
8
+ z.object({ status: z.literal('proving'), jobId: z.string(), proofType: z.number(), startedAtISO: z.string() }),
9
+ ]);
7
10
 
8
- isRunning(): Promise<boolean>;
11
+ export type ProverAgentStatus = z.infer<typeof ProverAgentStatusSchema>;
9
12
 
10
- getCurrentJobs(): Promise<{ id: string; type: string }[]>;
13
+ export interface ProverAgentApi {
14
+ getStatus(): Promise<unknown>;
11
15
  }
12
16
 
13
17
  export const ProverAgentApiSchema: ApiSchemaFor<ProverAgentApi> = {
14
- setMaxConcurrency: z.function().args(z.number().min(1).int()).returns(z.void()),
15
- isRunning: z.function().args().returns(z.boolean()),
16
- getCurrentJobs: z
17
- .function()
18
- .args()
19
- .returns(z.array(z.object({ id: z.string(), type: z.string() }))),
18
+ getStatus: z.function().args().returns(ProverAgentStatusSchema),
20
19
  };
@@ -1,5 +1,5 @@
1
1
  import {
2
- AVM_PROOF_LENGTH_IN_FIELDS,
2
+ AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
3
3
  NESTED_RECURSIVE_PROOF_LENGTH,
4
4
  NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
5
5
  RECURSIVE_PROOF_LENGTH,
@@ -179,7 +179,7 @@ export type ProvingJobInputsMap = {
179
179
  export const ProvingJobResult = z.discriminatedUnion('type', [
180
180
  z.object({
181
181
  type: z.literal(ProvingRequestType.PUBLIC_VM),
182
- result: schemaForRecursiveProofAndVerificationKey(AVM_PROOF_LENGTH_IN_FIELDS),
182
+ result: schemaForRecursiveProofAndVerificationKey(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED),
183
183
  }),
184
184
  z.object({
185
185
  type: z.literal(ProvingRequestType.PRIVATE_BASE_ROLLUP),
@@ -249,7 +249,7 @@ export const ProvingJobResult = z.discriminatedUnion('type', [
249
249
  ]);
250
250
  export type ProvingJobResult = z.infer<typeof ProvingJobResult>;
251
251
  export type ProvingJobResultsMap = {
252
- [ProvingRequestType.PUBLIC_VM]: ProofAndVerificationKey<typeof AVM_PROOF_LENGTH_IN_FIELDS>;
252
+ [ProvingRequestType.PUBLIC_VM]: ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>;
253
253
  [ProvingRequestType.PRIVATE_BASE_ROLLUP]: PublicInputsAndRecursiveProof<
254
254
  BaseOrMergeRollupPublicInputs,
255
255
  typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
@@ -1,5 +1,5 @@
1
1
  import type {
2
- AVM_PROOF_LENGTH_IN_FIELDS,
2
+ AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
3
3
  NESTED_RECURSIVE_PROOF_LENGTH,
4
4
  NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
5
5
  RECURSIVE_PROOF_LENGTH,
@@ -149,9 +149,10 @@ export interface ServerCircuitProver {
149
149
  */
150
150
  getAvmProof(
151
151
  inputs: AvmCircuitInputs,
152
+ skipPublicInputsValidation?: boolean, // TODO(#14234)[Unconditional PIs validation]: Remove.
152
153
  signal?: AbortSignal,
153
154
  epochNumber?: number,
154
- ): Promise<ProofAndVerificationKey<typeof AVM_PROOF_LENGTH_IN_FIELDS>>;
155
+ ): Promise<ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>>;
155
156
  }
156
157
 
157
158
  /**
@@ -148,9 +148,9 @@ export function findPrivateKernelResetDimensions(
148
148
  ? isEnough
149
149
  : // If isInner is true, it's a reset to prevent overflow. The following must be zero because siloing can't be done at the moment.
150
150
  (dimensions: PrivateKernelResetDimensions) =>
151
- dimensions.NOTE_HASH_SILOING_AMOUNT === 0 &&
152
- dimensions.NULLIFIER_SILOING_AMOUNT === 0 &&
153
- dimensions.PRIVATE_LOG_SILOING_AMOUNT === 0 &&
151
+ dimensions.NOTE_HASH_SILOING === 0 &&
152
+ dimensions.NULLIFIER_SILOING === 0 &&
153
+ dimensions.PRIVATE_LOG_SILOING === 0 &&
154
154
  isEnough(dimensions);
155
155
 
156
156
  const options = [
@@ -5,20 +5,18 @@ export class KeyValidationHint {
5
5
  constructor(
6
6
  /** Master secret key used to derive sk_app and pk_m. */
7
7
  public skM: GrumpkinScalar,
8
- /** Index of the request in the array of hints. */
9
- public requestIndex: number,
10
8
  ) {}
11
9
 
12
10
  static fromBuffer(buffer: Buffer | BufferReader) {
13
11
  const reader = BufferReader.asReader(buffer);
14
- return new KeyValidationHint(reader.readObject(GrumpkinScalar), reader.readNumber());
12
+ return new KeyValidationHint(reader.readObject(GrumpkinScalar));
15
13
  }
16
14
 
17
15
  toBuffer() {
18
- return serializeToBuffer(this.skM, this.requestIndex);
16
+ return serializeToBuffer(this.skM);
19
17
  }
20
18
 
21
- static nada(keyValidationRequestLen: number) {
22
- return new KeyValidationHint(GrumpkinScalar.zero(), keyValidationRequestLen);
19
+ static empty() {
20
+ return new KeyValidationHint(GrumpkinScalar.zero());
23
21
  }
24
22
  }