@aztec/stdlib 0.0.1-commit.d431d1c → 0.0.1-commit.e3c1de76

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 (167) hide show
  1. package/dest/block/block_hash.d.ts +16 -18
  2. package/dest/block/block_hash.d.ts.map +1 -1
  3. package/dest/block/block_hash.js +21 -31
  4. package/dest/block/block_parameter.d.ts +4 -4
  5. package/dest/block/block_parameter.d.ts.map +1 -1
  6. package/dest/block/block_parameter.js +2 -2
  7. package/dest/block/checkpointed_l2_block.d.ts +6 -6
  8. package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
  9. package/dest/block/checkpointed_l2_block.js +3 -3
  10. package/dest/block/in_block.d.ts +11 -11
  11. package/dest/block/in_block.d.ts.map +1 -1
  12. package/dest/block/in_block.js +4 -4
  13. package/dest/block/index.d.ts +2 -2
  14. package/dest/block/index.d.ts.map +1 -1
  15. package/dest/block/index.js +1 -1
  16. package/dest/block/{l2_block_new.d.ts → l2_block.d.ts} +8 -7
  17. package/dest/block/l2_block.d.ts.map +1 -0
  18. package/dest/block/{l2_block_new.js → l2_block.js} +5 -9
  19. package/dest/block/l2_block_source.d.ts +39 -30
  20. package/dest/block/l2_block_source.d.ts.map +1 -1
  21. package/dest/block/l2_block_stream/interfaces.d.ts +3 -3
  22. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  23. package/dest/block/l2_block_stream/l2_block_stream.d.ts +2 -3
  24. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  25. package/dest/block/l2_block_stream/l2_block_stream.js +4 -4
  26. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +3 -3
  27. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  28. package/dest/block/test/l2_tips_store_test_suite.js +2 -2
  29. package/dest/checkpoint/checkpoint.d.ts +8 -8
  30. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  31. package/dest/checkpoint/checkpoint.js +4 -4
  32. package/dest/checkpoint/published_checkpoint.d.ts +2 -2
  33. package/dest/config/node-rpc-config.js +1 -1
  34. package/dest/contract/contract_address.js +1 -1
  35. package/dest/contract/contract_class_id.d.ts +1 -1
  36. package/dest/contract/contract_class_id.js +1 -1
  37. package/dest/contract/private_function.d.ts +1 -1
  38. package/dest/contract/private_function.d.ts.map +1 -1
  39. package/dest/contract/private_function.js +2 -3
  40. package/dest/contract/private_function_membership_proof.d.ts +1 -1
  41. package/dest/contract/private_function_membership_proof.js +1 -1
  42. package/dest/database-version/database_version.d.ts +58 -0
  43. package/dest/database-version/database_version.d.ts.map +1 -0
  44. package/dest/database-version/database_version.js +69 -0
  45. package/dest/database-version/version_manager.d.ts +2 -50
  46. package/dest/database-version/version_manager.d.ts.map +1 -1
  47. package/dest/database-version/version_manager.js +1 -66
  48. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
  49. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
  50. package/dest/delayed_public_mutable/delayed_public_mutable_values.js +7 -10
  51. package/dest/epoch-helpers/index.d.ts +3 -1
  52. package/dest/epoch-helpers/index.d.ts.map +1 -1
  53. package/dest/epoch-helpers/index.js +5 -1
  54. package/dest/hash/hash.js +2 -2
  55. package/dest/hash/map_slot.d.ts +1 -1
  56. package/dest/hash/map_slot.d.ts.map +1 -1
  57. package/dest/hash/map_slot.js +4 -3
  58. package/dest/interfaces/archiver.d.ts +1 -1
  59. package/dest/interfaces/archiver.d.ts.map +1 -1
  60. package/dest/interfaces/archiver.js +17 -16
  61. package/dest/interfaces/aztec-node-admin.d.ts +4 -1
  62. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  63. package/dest/interfaces/aztec-node.d.ts +24 -38
  64. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  65. package/dest/interfaces/aztec-node.js +12 -16
  66. package/dest/interfaces/block-builder.d.ts +13 -7
  67. package/dest/interfaces/block-builder.d.ts.map +1 -1
  68. package/dest/interfaces/block-builder.js +7 -0
  69. package/dest/interfaces/configs.d.ts +2 -2
  70. package/dest/interfaces/configs.d.ts.map +1 -1
  71. package/dest/interfaces/get_logs_response.d.ts +7 -7
  72. package/dest/interfaces/prover-client.d.ts +10 -1
  73. package/dest/interfaces/prover-client.d.ts.map +1 -1
  74. package/dest/interfaces/prover-client.js +7 -1
  75. package/dest/interfaces/tx_provider.d.ts +3 -3
  76. package/dest/interfaces/tx_provider.d.ts.map +1 -1
  77. package/dest/interfaces/validator.d.ts +3 -3
  78. package/dest/interfaces/validator.d.ts.map +1 -1
  79. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
  80. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
  81. package/dest/kernel/hints/build_nullifier_read_request_hints.js +4 -6
  82. package/dest/l1-contracts/slash_factory.d.ts +1 -1
  83. package/dest/l1-contracts/slash_factory.d.ts.map +1 -1
  84. package/dest/l1-contracts/slash_factory.js +1 -0
  85. package/dest/logs/extended_public_log.d.ts +6 -6
  86. package/dest/logs/log_id.d.ts +8 -8
  87. package/dest/logs/log_id.d.ts.map +1 -1
  88. package/dest/logs/log_id.js +6 -5
  89. package/dest/logs/siloed_tag.d.ts +1 -1
  90. package/dest/logs/siloed_tag.d.ts.map +1 -1
  91. package/dest/logs/siloed_tag.js +4 -3
  92. package/dest/p2p/block_proposal.d.ts +13 -6
  93. package/dest/p2p/block_proposal.d.ts.map +1 -1
  94. package/dest/p2p/block_proposal.js +1 -1
  95. package/dest/p2p/checkpoint_proposal.d.ts +10 -3
  96. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  97. package/dest/p2p/message_validator.d.ts +18 -3
  98. package/dest/p2p/message_validator.d.ts.map +1 -1
  99. package/dest/p2p/message_validator.js +2 -1
  100. package/dest/stats/stats.d.ts +1 -3
  101. package/dest/stats/stats.d.ts.map +1 -1
  102. package/dest/tests/factories.js +1 -1
  103. package/dest/tests/jest.d.ts +4 -4
  104. package/dest/tests/jest.js +9 -9
  105. package/dest/tests/mocks.d.ts +15 -10
  106. package/dest/tests/mocks.d.ts.map +1 -1
  107. package/dest/tests/mocks.js +19 -13
  108. package/dest/tx/block_header.d.ts +3 -2
  109. package/dest/tx/block_header.d.ts.map +1 -1
  110. package/dest/tx/block_header.js +3 -2
  111. package/dest/tx/in_tx.d.ts +3 -3
  112. package/dest/tx/indexed_tx_effect.d.ts +5 -5
  113. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  114. package/dest/tx/indexed_tx_effect.js +3 -2
  115. package/dest/tx/tx_receipt.d.ts +42 -14
  116. package/dest/tx/tx_receipt.d.ts.map +1 -1
  117. package/dest/tx/tx_receipt.js +46 -15
  118. package/package.json +11 -10
  119. package/src/block/block_hash.ts +26 -47
  120. package/src/block/block_parameter.ts +3 -3
  121. package/src/block/checkpointed_l2_block.ts +4 -4
  122. package/src/block/in_block.ts +7 -7
  123. package/src/block/index.ts +1 -1
  124. package/src/block/{l2_block_new.ts → l2_block.ts} +8 -12
  125. package/src/block/l2_block_source.ts +40 -31
  126. package/src/block/l2_block_stream/interfaces.ts +2 -2
  127. package/src/block/l2_block_stream/l2_block_stream.ts +5 -6
  128. package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
  129. package/src/block/test/l2_tips_store_test_suite.ts +4 -4
  130. package/src/checkpoint/checkpoint.ts +7 -7
  131. package/src/config/node-rpc-config.ts +1 -1
  132. package/src/contract/contract_address.ts +1 -1
  133. package/src/contract/contract_class_id.ts +1 -1
  134. package/src/contract/private_function.ts +2 -3
  135. package/src/contract/private_function_membership_proof.ts +1 -1
  136. package/src/database-version/database_version.ts +87 -0
  137. package/src/database-version/version_manager.ts +1 -77
  138. package/src/delayed_public_mutable/delayed_public_mutable_values.ts +9 -10
  139. package/src/epoch-helpers/index.ts +10 -1
  140. package/src/hash/hash.ts +2 -2
  141. package/src/hash/map_slot.ts +3 -2
  142. package/src/interfaces/archiver.ts +17 -25
  143. package/src/interfaces/aztec-node.ts +39 -93
  144. package/src/interfaces/block-builder.ts +15 -5
  145. package/src/interfaces/configs.ts +1 -3
  146. package/src/interfaces/prover-client.ts +15 -0
  147. package/src/interfaces/tx_provider.ts +2 -2
  148. package/src/interfaces/validator.ts +2 -4
  149. package/src/kernel/hints/build_nullifier_read_request_hints.ts +1 -10
  150. package/src/l1-contracts/slash_factory.ts +1 -0
  151. package/src/logs/log_id.ts +7 -6
  152. package/src/logs/siloed_tag.ts +3 -2
  153. package/src/p2p/block_proposal.ts +12 -5
  154. package/src/p2p/checkpoint_proposal.ts +9 -2
  155. package/src/p2p/message_validator.ts +14 -2
  156. package/src/stats/stats.ts +0 -2
  157. package/src/tests/factories.ts +1 -1
  158. package/src/tests/jest.ts +9 -9
  159. package/src/tests/mocks.ts +26 -17
  160. package/src/tx/block_header.ts +7 -4
  161. package/src/tx/indexed_tx_effect.ts +3 -2
  162. package/src/tx/tx_receipt.ts +75 -18
  163. package/dest/block/l2_block_new.d.ts.map +0 -1
  164. package/dest/database-version/index.d.ts +0 -2
  165. package/dest/database-version/index.d.ts.map +0 -1
  166. package/dest/database-version/index.js +0 -1
  167. package/src/database-version/index.ts +0 -1
@@ -1,10 +1,4 @@
1
- import {
2
- ARCHIVE_HEIGHT,
3
- L1_TO_L2_MSG_TREE_HEIGHT,
4
- NOTE_HASH_TREE_HEIGHT,
5
- NULLIFIER_TREE_HEIGHT,
6
- PUBLIC_DATA_TREE_HEIGHT,
7
- } from '@aztec/constants';
1
+ import { ARCHIVE_HEIGHT, L1_TO_L2_MSG_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
8
2
  import { type L1ContractAddresses, L1ContractAddressesSchema } from '@aztec/ethereum/l1-contract-addresses';
9
3
  import {
10
4
  BlockNumber,
@@ -23,10 +17,11 @@ import { MembershipWitness, SiblingPath } from '@aztec/foundation/trees';
23
17
  import { z } from 'zod';
24
18
 
25
19
  import type { AztecAddress } from '../aztec-address/index.js';
20
+ import { BlockHash } from '../block/block_hash.js';
26
21
  import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
27
22
  import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
28
23
  import { type DataInBlock, dataInBlockSchemaFor } from '../block/in_block.js';
29
- import { L2BlockNew } from '../block/l2_block_new.js';
24
+ import { L2Block } from '../block/l2_block.js';
30
25
  import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
31
26
  import { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
32
27
  import {
@@ -77,13 +72,7 @@ import { type WorldStateSyncStatus, WorldStateSyncStatusSchema } from './world_s
77
72
  export interface AztecNode
78
73
  extends Pick<
79
74
  L2BlockSource,
80
- | 'getBlocks'
81
- | 'getL2BlocksNew'
82
- | 'getPublishedBlocks'
83
- | 'getPublishedCheckpoints'
84
- | 'getBlockHeader'
85
- | 'getL2Tips'
86
- | 'getCheckpointedBlocks'
75
+ 'getBlocks' | 'getCheckpoints' | 'getBlockHeader' | 'getL2Tips' | 'getCheckpointedBlocks'
87
76
  > {
88
77
  /**
89
78
  * Returns the tips of the L2 chain.
@@ -109,41 +98,6 @@ export interface AztecNode
109
98
  leafValues: Fr[],
110
99
  ): Promise<(DataInBlock<bigint> | undefined)[]>;
111
100
 
112
- /**
113
- * Returns a sibling path for the given index in the nullifier tree.
114
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
115
- * @param leafIndex - The index of the leaf for which the sibling path is required.
116
- * @returns The sibling path for the leaf index.
117
- */
118
- getNullifierSiblingPath(block: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof NULLIFIER_TREE_HEIGHT>>;
119
-
120
- /**
121
- * Returns a sibling path for the given index in the note hash tree.
122
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
123
- * @param leafIndex - The index of the leaf for which the sibling path is required.
124
- * @returns The sibling path for the leaf index.
125
- */
126
- getNoteHashSiblingPath(block: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof NOTE_HASH_TREE_HEIGHT>>;
127
-
128
- /**
129
- * Returns a sibling path for a leaf in the committed historic blocks tree.
130
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
131
- * @param leafIndex - Index of the leaf in the tree.
132
- * @returns The sibling path.
133
- */
134
- getArchiveSiblingPath(block: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof ARCHIVE_HEIGHT>>;
135
-
136
- /**
137
- * Returns a sibling path for a leaf in the committed public data tree.
138
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
139
- * @param leafIndex - Index of the leaf in the tree.
140
- * @returns The sibling path.
141
- */
142
- getPublicDataSiblingPath(
143
- block: BlockParameter,
144
- leafIndex: bigint,
145
- ): Promise<SiblingPath<typeof PUBLIC_DATA_TREE_HEIGHT>>;
146
-
147
101
  /**
148
102
  * Returns a nullifier membership witness for a given nullifier at a given block.
149
103
  * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
@@ -232,21 +186,21 @@ export interface AztecNode
232
186
  * @param number - The block number or 'latest'.
233
187
  * @returns The requested block.
234
188
  */
235
- getBlock(number: BlockParameter): Promise<L2BlockNew | undefined>;
189
+ getBlock(number: BlockParameter): Promise<L2Block | undefined>;
236
190
 
237
191
  /**
238
192
  * Get a block specified by its hash.
239
193
  * @param blockHash - The block hash being requested.
240
194
  * @returns The requested block.
241
195
  */
242
- getBlockByHash(blockHash: Fr): Promise<L2BlockNew | undefined>;
196
+ getBlockByHash(blockHash: BlockHash): Promise<L2Block | undefined>;
243
197
 
244
198
  /**
245
199
  * Get a block specified by its archive root.
246
200
  * @param archive - The archive root being requested.
247
201
  * @returns The requested block.
248
202
  */
249
- getBlockByArchive(archive: Fr): Promise<L2BlockNew | undefined>;
203
+ getBlockByArchive(archive: Fr): Promise<L2Block | undefined>;
250
204
 
251
205
  /**
252
206
  * Method to fetch the latest block number synchronized by the node.
@@ -260,6 +214,12 @@ export interface AztecNode
260
214
  */
261
215
  getProvenBlockNumber(): Promise<BlockNumber>;
262
216
 
217
+ /**
218
+ * Fetches the latest checkpointed block number.
219
+ * @returns The block number.
220
+ */
221
+ getCheckpointedBlockNumber(): Promise<BlockNumber>;
222
+
263
223
  /**
264
224
  * Method to determine if the node is ready to accept transactions.
265
225
  * @returns - Flag indicating the readiness for tx submission.
@@ -279,7 +239,7 @@ export interface AztecNode
279
239
  * @param limit - The maximum number of blocks to return.
280
240
  * @returns The blocks requested.
281
241
  */
282
- getBlocks(from: BlockNumber, limit: number): Promise<L2BlockNew[]>;
242
+ getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
283
243
 
284
244
  /**
285
245
  * Method to fetch the current min fees.
@@ -347,10 +307,14 @@ export interface AztecNode
347
307
  * array implies no logs match that tag.
348
308
  * @param tags - The tags to search for.
349
309
  * @param page - The page number (0-indexed) for pagination.
310
+ * @param referenceBlock - Optional block hash used to ensure the block still exists before logs are retrieved.
311
+ * This block is expected to represent the latest block to which the client has synced (called anchor block in PXE).
312
+ * If specified and the block is not found, an error is thrown. This helps detect reorgs, which could result in
313
+ * undefined behavior in the client's code.
350
314
  * @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
351
315
  * for a tag, the caller should fetch the next page to check for more logs.
352
316
  */
353
- getPrivateLogsByTags(tags: SiloedTag[], page?: number): Promise<TxScopedL2Log[][]>;
317
+ getPrivateLogsByTags(tags: SiloedTag[], page?: number, referenceBlock?: BlockHash): Promise<TxScopedL2Log[][]>;
354
318
 
355
319
  /**
356
320
  * Gets public logs that match any of the `tags` from the specified contract. For each tag, an array of matching
@@ -358,6 +322,10 @@ export interface AztecNode
358
322
  * @param contractAddress - The contract address to search logs for.
359
323
  * @param tags - The tags to search for.
360
324
  * @param page - The page number (0-indexed) for pagination.
325
+ * @param referenceBlock - Optional block hash used to ensure the block still exists before logs are retrieved.
326
+ * This block is expected to represent the latest block to which the client has synced (called anchor block in PXE).
327
+ * If specified and the block is not found, an error is thrown. This helps detect reorgs, which could result in
328
+ * undefined behavior in the client's code.
361
329
  * @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
362
330
  * for a tag, the caller should fetch the next page to check for more logs.
363
331
  */
@@ -365,6 +333,7 @@ export interface AztecNode
365
333
  contractAddress: AztecAddress,
366
334
  tags: Tag[],
367
335
  page?: number,
336
+ referenceBlock?: BlockHash,
368
337
  ): Promise<TxScopedL2Log[][]>;
369
338
 
370
339
  /**
@@ -508,26 +477,6 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
508
477
  .args(BlockParameterSchema, z.nativeEnum(MerkleTreeId), z.array(schemas.Fr).max(MAX_RPC_LEN))
509
478
  .returns(z.array(optional(dataInBlockSchemaFor(schemas.BigInt)))),
510
479
 
511
- getNullifierSiblingPath: z
512
- .function()
513
- .args(BlockParameterSchema, schemas.BigInt)
514
- .returns(SiblingPath.schemaFor(NULLIFIER_TREE_HEIGHT)),
515
-
516
- getNoteHashSiblingPath: z
517
- .function()
518
- .args(BlockParameterSchema, schemas.BigInt)
519
- .returns(SiblingPath.schemaFor(NOTE_HASH_TREE_HEIGHT)),
520
-
521
- getArchiveSiblingPath: z
522
- .function()
523
- .args(BlockParameterSchema, schemas.BigInt)
524
- .returns(SiblingPath.schemaFor(ARCHIVE_HEIGHT)),
525
-
526
- getPublicDataSiblingPath: z
527
- .function()
528
- .args(BlockParameterSchema, schemas.BigInt)
529
- .returns(SiblingPath.schemaFor(PUBLIC_DATA_TREE_HEIGHT)),
530
-
531
480
  getNullifierMembershipWitness: z
532
481
  .function()
533
482
  .args(BlockParameterSchema, schemas.Fr)
@@ -567,16 +516,18 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
567
516
  .args(EpochNumberSchema)
568
517
  .returns(z.array(z.array(z.array(z.array(schemas.Fr))))),
569
518
 
570
- getBlock: z.function().args(BlockParameterSchema).returns(L2BlockNew.schema.optional()),
519
+ getBlock: z.function().args(BlockParameterSchema).returns(L2Block.schema.optional()),
571
520
 
572
- getBlockByHash: z.function().args(schemas.Fr).returns(L2BlockNew.schema.optional()),
521
+ getBlockByHash: z.function().args(BlockHash.schema).returns(L2Block.schema.optional()),
573
522
 
574
- getBlockByArchive: z.function().args(schemas.Fr).returns(L2BlockNew.schema.optional()),
523
+ getBlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
575
524
 
576
525
  getBlockNumber: z.function().returns(BlockNumberSchema),
577
526
 
578
527
  getProvenBlockNumber: z.function().returns(BlockNumberSchema),
579
528
 
529
+ getCheckpointedBlockNumber: z.function().returns(BlockNumberSchema),
530
+
580
531
  isReady: z.function().returns(z.boolean()),
581
532
 
582
533
  getNodeInfo: z.function().returns(NodeInfoSchema),
@@ -584,26 +535,16 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
584
535
  getBlocks: z
585
536
  .function()
586
537
  .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
587
- .returns(z.array(L2BlockNew.schema)),
538
+ .returns(z.array(L2Block.schema)),
588
539
 
589
- getPublishedBlocks: z
590
- .function()
591
- .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
592
- .returns(z.array(CheckpointedL2Block.schema)),
593
-
594
- getPublishedCheckpoints: z
540
+ getCheckpoints: z
595
541
  .function()
596
542
  .args(CheckpointNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_CHECKPOINTS_LEN))
597
543
  .returns(z.array(PublishedCheckpoint.schema)),
598
544
 
599
- getL2BlocksNew: z
600
- .function()
601
- .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
602
- .returns(z.array(L2BlockNew.schema)),
603
-
604
545
  getCheckpointedBlocks: z
605
546
  .function()
606
- .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN), optional(z.boolean()))
547
+ .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
607
548
  .returns(z.array(CheckpointedL2Block.schema)),
608
549
 
609
550
  getCurrentMinFees: z.function().returns(GasFees.schema),
@@ -631,12 +572,17 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
631
572
 
632
573
  getPrivateLogsByTags: z
633
574
  .function()
634
- .args(z.array(SiloedTag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)))
575
+ .args(z.array(SiloedTag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)), optional(BlockHash.schema))
635
576
  .returns(z.array(z.array(TxScopedL2Log.schema))),
636
577
 
637
578
  getPublicLogsByTagsFromContract: z
638
579
  .function()
639
- .args(schemas.AztecAddress, z.array(Tag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)))
580
+ .args(
581
+ schemas.AztecAddress,
582
+ z.array(Tag.schema).max(MAX_RPC_LEN),
583
+ optional(z.number().gte(0)),
584
+ optional(BlockHash.schema),
585
+ )
640
586
  .returns(z.array(z.array(TxScopedL2Log.schema))),
641
587
 
642
588
  sendTx: z.function().args(Tx.schema).returns(z.void()),
@@ -1,7 +1,8 @@
1
1
  import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
2
2
  import type { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { LoggerBindings } from '@aztec/foundation/log';
3
4
 
4
- import type { L2BlockNew } from '../block/l2_block_new.js';
5
+ import type { L2Block } from '../block/l2_block.js';
5
6
  import type { ChainConfig, SequencerConfig } from '../config/chain-config.js';
6
7
  import type { L1RollupConstants } from '../epoch-helpers/index.js';
7
8
  import type { Gas } from '../gas/gas.js';
@@ -31,7 +32,7 @@ export interface IBlockFactory extends ProcessedTxHandler {
31
32
  /**
32
33
  * Assembles the block and updates the archive tree.
33
34
  */
34
- setBlockCompleted(expectedBlockHeader?: BlockHeader): Promise<L2BlockNew>;
35
+ setBlockCompleted(expectedBlockHeader?: BlockHeader): Promise<L2Block>;
35
36
  }
36
37
 
37
38
  export interface PublicProcessorLimits {
@@ -61,16 +62,24 @@ export const FullNodeBlockBuilderConfigKeys: (keyof FullNodeBlockBuilderConfig)[
61
62
  'fakeThrowAfterProcessingTxCount',
62
63
  ] as const;
63
64
 
65
+ /** Thrown when no valid transactions are available to include in a block after processing, and this is not the first block in a checkpoint. */
66
+ export class NoValidTxsError extends Error {
67
+ constructor(public readonly failedTxs: FailedTx[]) {
68
+ super('No valid transactions to include in block');
69
+ this.name = 'NoValidTxsError';
70
+ }
71
+ }
72
+
64
73
  /** Result of building a block within a checkpoint. */
65
- export interface BuildBlockInCheckpointResult {
66
- block: L2BlockNew;
74
+ export type BuildBlockInCheckpointResult = {
75
+ block: L2Block;
67
76
  publicGas: Gas;
68
77
  publicProcessorDuration: number;
69
78
  numTxs: number;
70
79
  failedTxs: FailedTx[];
71
80
  usedTxs: Tx[];
72
81
  usedTxBlobFields: number;
73
- }
82
+ };
74
83
 
75
84
  /** Interface for building blocks within a checkpoint context. */
76
85
  export interface ICheckpointBlockBuilder {
@@ -92,5 +101,6 @@ export interface ICheckpointsBuilder {
92
101
  l1ToL2Messages: Fr[],
93
102
  previousCheckpointOutHashes: Fr[],
94
103
  fork: MerkleTreeWriteOperations,
104
+ bindings?: LoggerBindings,
95
105
  ): Promise<ICheckpointBlockBuilder>;
96
106
  }
@@ -67,9 +67,7 @@ export interface SequencerConfig {
67
67
  blockDurationMs?: number;
68
68
  /** Have sequencer build and publish an empty checkpoint if there are no txs */
69
69
  buildCheckpointIfEmpty?: boolean;
70
-
71
- // TODO(palla/mbps): Change default to false once block sync is stable
72
- /** Skip pushing proposed blocks to archiver (default: true) */
70
+ /** Skip pushing proposed blocks to archiver (default: false) */
73
71
  skipPushProposedBlocksToArchiver?: boolean;
74
72
  }
75
73
 
@@ -17,6 +17,12 @@ export type ActualProverConfig = {
17
17
  proverTestDelayMs: number;
18
18
  /** If using realistic delays, what percentage of realistic times to apply. */
19
19
  proverTestDelayFactor: number;
20
+ /**
21
+ * Whether to abort pending proving jobs when the orchestrator is cancelled.
22
+ * When false (default), jobs remain in the broker queue and can be reused on restart/reorg.
23
+ * When true, jobs are explicitly cancelled with the broker, which prevents reuse.
24
+ */
25
+ cancelJobsOnStop: boolean;
20
26
  };
21
27
 
22
28
  /**
@@ -43,6 +49,7 @@ export const ProverConfigSchema = zodFor<ProverConfig>()(
43
49
  proverTestDelayFactor: z.number(),
44
50
  proverAgentCount: z.number(),
45
51
  failedProofStore: z.string().optional(),
52
+ cancelJobsOnStop: z.boolean(),
46
53
  }),
47
54
  );
48
55
 
@@ -85,6 +92,14 @@ export const proverConfigMappings: ConfigMappingsType<ProverConfig> = {
85
92
  description:
86
93
  'Store for failed proof inputs. Google cloud storage is only supported at the moment. Set this value as gs://bucket-name/path/to/store.',
87
94
  },
95
+ cancelJobsOnStop: {
96
+ env: 'PROVER_CANCEL_JOBS_ON_STOP',
97
+ description:
98
+ 'Whether to abort pending proving jobs when the orchestrator is cancelled. ' +
99
+ 'When false (default), jobs remain in the broker queue and can be reused on restart/reorg. ' +
100
+ 'When true, jobs are explicitly cancelled with the broker, which prevents reuse.',
101
+ ...booleanConfigHelper(false),
102
+ },
88
103
  };
89
104
 
90
105
  function parseProverId(str?: string) {
@@ -1,4 +1,4 @@
1
- import type { L2BlockNew } from '@aztec/stdlib/block';
1
+ import type { L2Block } from '@aztec/stdlib/block';
2
2
  import type { BlockProposal } from '@aztec/stdlib/p2p';
3
3
  import { type Tx, TxHash } from '@aztec/stdlib/tx';
4
4
 
@@ -13,5 +13,5 @@ export interface ITxProvider {
13
13
  opts: { pinnedPeer: PeerId | undefined; deadline: Date },
14
14
  ): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
15
15
 
16
- getTxsForBlock(block: L2BlockNew, opts: { deadline: Date }): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
16
+ getTxsForBlock(block: L2Block, opts: { deadline: Date }): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
17
17
  }
@@ -51,12 +51,10 @@ export type ValidatorClientConfig = ValidatorHASignerConfig & {
51
51
  /** Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus */
52
52
  fishermanMode?: boolean;
53
53
 
54
- // TODO(palla/mbps): Change default to false once checkpoint validation is stable
55
- /** Skip checkpoint proposal validation and always attest (default: true) */
54
+ /** Skip checkpoint proposal validation and always attest (default: false) */
56
55
  skipCheckpointProposalValidation?: boolean;
57
56
 
58
- // TODO(palla/mbps): Change default to false once block sync is stable
59
- /** Skip pushing re-executed blocks to archiver (default: true) */
57
+ /** Skip pushing re-executed blocks to archiver (default: false) */
60
58
  skipPushProposedBlocksToArchiver?: boolean;
61
59
  };
62
60
 
@@ -6,7 +6,6 @@ import {
6
6
  import type { Fr } from '@aztec/foundation/curves/bn254';
7
7
  import { MembershipWitness } from '@aztec/foundation/trees';
8
8
 
9
- import { siloNullifier } from '../../hash/hash.js';
10
9
  import type { NullifierLeafPreimage } from '../../trees/nullifier_leaf.js';
11
10
  import type { ClaimedLengthArray } from '../claimed_length_array.js';
12
11
  import type { ScopedNullifier } from '../nullifier.js';
@@ -74,7 +73,6 @@ export async function buildNullifierReadRequestHintsFromResetActions<PENDING ext
74
73
  resetActions: ReadRequestResetActions<typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>,
75
74
  maxPending: PENDING = MAX_NULLIFIER_READ_REQUESTS_PER_TX as PENDING,
76
75
  maxSettled: SETTLED = MAX_NULLIFIER_READ_REQUESTS_PER_TX as SETTLED,
77
- siloed = false,
78
76
  ) {
79
77
  const builder = new NullifierReadRequestHintsBuilder(maxPending, maxSettled);
80
78
 
@@ -90,12 +88,7 @@ export async function buildNullifierReadRequestHintsFromResetActions<PENDING ext
90
88
  }
91
89
  }
92
90
 
93
- // Compute siloed values in parallel (if not already siloed)
94
- const siloedValues = siloed
95
- ? settledRequests.map(({ readRequest }) => readRequest.value)
96
- : await Promise.all(
97
- settledRequests.map(({ readRequest }) => siloNullifier(readRequest.contractAddress, readRequest.value)),
98
- );
91
+ const siloedValues = settledRequests.map(({ readRequest }) => readRequest.value);
99
92
 
100
93
  // Fetch all membership witnesses in parallel
101
94
  const membershipWitnesses = await Promise.all(siloedValues.map(value => oracle.getNullifierMembershipWitness(value)));
@@ -121,7 +114,6 @@ export async function buildNullifierReadRequestHints<PENDING extends number, SET
121
114
  futureNullifiers: ScopedNullifier[],
122
115
  maxPending: PENDING = MAX_NULLIFIER_READ_REQUESTS_PER_TX as PENDING,
123
116
  maxSettled: SETTLED = MAX_NULLIFIER_READ_REQUESTS_PER_TX as SETTLED,
124
- siloed = false,
125
117
  ) {
126
118
  const resetActions = getNullifierReadRequestResetActions(nullifierReadRequests, nullifiers, futureNullifiers);
127
119
  return await buildNullifierReadRequestHintsFromResetActions(
@@ -130,6 +122,5 @@ export async function buildNullifierReadRequestHints<PENDING extends number, SET
130
122
  resetActions,
131
123
  maxPending,
132
124
  maxSettled,
133
- siloed,
134
125
  );
135
126
  }
@@ -41,6 +41,7 @@ export class SlashFactoryContract {
41
41
 
42
42
  return {
43
43
  to: this.contract.address,
44
+ abi: SlashFactoryAbi,
44
45
  data: encodeFunctionData({
45
46
  abi: SlashFactoryAbi,
46
47
  functionName: 'createSlashPayload',
@@ -1,11 +1,12 @@
1
1
  import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
2
2
  import { toBufferBE } from '@aztec/foundation/bigint-buffer';
3
3
  import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
5
  import { BufferReader } from '@aztec/foundation/serialize';
5
6
 
6
7
  import { z } from 'zod';
7
8
 
8
- import { L2BlockHash } from '../block/block_hash.js';
9
+ import { BlockHash } from '../block/block_hash.js';
9
10
  import { schemas } from '../schemas/index.js';
10
11
 
11
12
  /** A globally unique log id. */
@@ -20,7 +21,7 @@ export class LogId {
20
21
  /** The block number the log was emitted in. */
21
22
  public readonly blockNumber: BlockNumber,
22
23
  /** The hash of the block the log was emitted in. */
23
- public readonly blockHash: L2BlockHash,
24
+ public readonly blockHash: BlockHash,
24
25
  /** The index of a tx in a block the log was emitted in. */
25
26
  public readonly txIndex: number,
26
27
  /** The index of a log the tx was emitted in. */
@@ -40,7 +41,7 @@ export class LogId {
40
41
  static random() {
41
42
  return new LogId(
42
43
  BlockNumber(Math.floor(Math.random() * 1000) + 1),
43
- L2BlockHash.random(),
44
+ BlockHash.random(),
44
45
  Math.floor(Math.random() * 1000),
45
46
  Math.floor(Math.random() * 100),
46
47
  );
@@ -50,7 +51,7 @@ export class LogId {
50
51
  return z
51
52
  .object({
52
53
  blockNumber: BlockNumberSchema,
53
- blockHash: L2BlockHash.schema,
54
+ blockHash: BlockHash.schema,
54
55
  txIndex: schemas.Integer,
55
56
  logIndex: schemas.Integer,
56
57
  })
@@ -81,7 +82,7 @@ export class LogId {
81
82
  const reader = BufferReader.asReader(buffer);
82
83
 
83
84
  const blockNumber = BlockNumber(reader.readNumber());
84
- const blockHash = reader.readObject(L2BlockHash);
85
+ const blockHash = new BlockHash(reader.readObject(Fr));
85
86
  const txIndex = reader.readNumber();
86
87
  const logIndex = reader.readNumber();
87
88
 
@@ -104,7 +105,7 @@ export class LogId {
104
105
  static fromString(data: string): LogId {
105
106
  const [rawBlockNumber, rawTxIndex, rawLogIndex, rawBlockHash] = data.split('-');
106
107
  const blockNumber = BlockNumber(Number(rawBlockNumber));
107
- const blockHash = L2BlockHash.fromString(rawBlockHash);
108
+ const blockHash = BlockHash.fromString(rawBlockHash);
108
109
  const txIndex = Number(rawTxIndex);
109
110
  const logIndex = Number(rawLogIndex);
110
111
 
@@ -1,4 +1,5 @@
1
- import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
1
+ import { GeneratorIndex } from '@aztec/constants';
2
+ import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
2
3
  import type { Fr } from '@aztec/foundation/curves/bn254';
3
4
  import type { ZodFor } from '@aztec/foundation/schemas';
4
5
 
@@ -22,7 +23,7 @@ export class SiloedTag {
22
23
  constructor(public readonly value: Fr) {}
23
24
 
24
25
  static async compute(tag: Tag, app: AztecAddress): Promise<SiloedTag> {
25
- const siloedTag = await poseidon2Hash([app, tag.value]);
26
+ const siloedTag = await poseidon2HashWithSeparator([app, tag.value], GeneratorIndex.PRIVATE_LOG_FIRST_FIELD);
26
27
  return new SiloedTag(siloedTag);
27
28
  }
28
29
 
@@ -8,8 +8,8 @@ import { Signature } from '@aztec/foundation/eth-signature';
8
8
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
9
9
  import { DutyType, type SigningContext } from '@aztec/validator-ha-signer/types';
10
10
 
11
+ import type { L2Block } from '../block/l2_block.js';
11
12
  import type { L2BlockInfo } from '../block/l2_block_info.js';
12
- import type { L2BlockNew } from '../block/l2_block_new.js';
13
13
  import { MAX_TXS_PER_BLOCK } from '../deserialization/index.js';
14
14
  import { BlockHeader } from '../tx/block_header.js';
15
15
  import { TxHash } from '../tx/index.js';
@@ -30,8 +30,15 @@ export class BlockProposalHash extends Buffer32 {
30
30
  }
31
31
 
32
32
  export type BlockProposalOptions = {
33
- publishFullTxs: boolean;
34
- /** Whether to generate an invalid block proposal for broadcasting. Use only for testing. */
33
+ /**
34
+ * Whether to include the tx objects along with the block proposal.
35
+ * Dramatically increases size of the payload but eliminates failed reexecutions due to missing txs.
36
+ */
37
+ publishFullTxs?: boolean;
38
+ /**
39
+ * Whether to generate an invalid block proposal for broadcasting.
40
+ * Use only for testing.
41
+ */
35
42
  broadcastInvalidBlockProposal?: boolean;
36
43
  };
37
44
 
@@ -284,10 +291,10 @@ export class BlockProposal extends Gossipable {
284
291
  /**
285
292
  * Check if this proposal matches the given block.
286
293
  * Compares the archive root and block header.
287
- * @param block - The L2BlockNew to compare against
294
+ * @param block - The L2Block to compare against
288
295
  * @returns True if the proposal matches the block
289
296
  */
290
- matchesBlock(block: L2BlockNew): boolean {
297
+ matchesBlock(block: L2Block): boolean {
291
298
  return this.archiveRoot.equals(block.archive.root) && this.blockHeader.equals(block.header);
292
299
  }
293
300
 
@@ -32,8 +32,15 @@ export class CheckpointProposalHash extends Buffer32 {
32
32
  }
33
33
 
34
34
  export type CheckpointProposalOptions = {
35
- publishFullTxs: boolean;
36
- /** Whether to generate an invalid checkpoint proposal for broadcasting. Use only for testing. */
35
+ /**
36
+ * Whether to include the tx objects along with the block proposal.
37
+ * Dramatically increases size of the payload but eliminates failed reexecutions due to missing txs.
38
+ */
39
+ publishFullTxs?: boolean;
40
+ /**
41
+ * Whether to generate an invalid checkpoint proposal for broadcasting.
42
+ * Use only for testing.
43
+ */
37
44
  broadcastInvalidCheckpointProposal?: boolean;
38
45
  };
39
46
 
@@ -1,10 +1,22 @@
1
1
  import type { PeerErrorSeverity } from './peer_error.js';
2
2
 
3
+ /**
4
+ * Result of validating a P2P message.
5
+ * - 'accept': Message is valid and should be accepted and processed
6
+ * - 'ignore': Message should be ignored (not propagated or processed, but sender not penalized)
7
+ * - 'reject': Message is invalid (rejected and sender penalized)
8
+ */
9
+ export type ValidationResult =
10
+ | { result: 'accept' }
11
+ | { result: 'ignore' }
12
+ | { result: 'reject'; severity: PeerErrorSeverity };
13
+
3
14
  /**
4
15
  * P2PValidator
5
16
  *
6
- * A validator for P2P messages, which returns a severity of error to be applied to the peer
17
+ * A validator for P2P messages, which returns a ValidationResult indicating
18
+ * whether to accept, ignore, or reject the message
7
19
  */
8
20
  export interface P2PValidator<T> {
9
- validate(message: T): Promise<PeerErrorSeverity | undefined>;
21
+ validate(message: T): Promise<ValidationResult>;
10
22
  }
@@ -202,8 +202,6 @@ export type L2BlockBuiltStats = {
202
202
  duration: number;
203
203
  /** Time for processing public txs in ms. */
204
204
  publicProcessDuration: number;
205
- /** Time for running rollup circuits in ms. */
206
- rollupCircuitsDuration: number;
207
205
  } & L2BlockStats;
208
206
 
209
207
  /** Stats for an L2 block processed by the world state synchronizer. */
@@ -1739,7 +1739,7 @@ export function makeL2Tips(
1739
1739
  ? typeof checkpointNumber === 'number'
1740
1740
  ? CheckpointNumber(checkpointNumber)
1741
1741
  : checkpointNumber
1742
- : CheckpointNumber(bn);
1742
+ : CheckpointNumber.fromBlockNumber(bn);
1743
1743
  const cph = checkpointHash ?? hash;
1744
1744
  return {
1745
1745
  proposed: { number: bn, hash },
package/src/tests/jest.ts CHANGED
@@ -1,26 +1,26 @@
1
- import { L2BlockNew } from '../block/l2_block_new.js';
1
+ import { L2Block } from '../block/l2_block.js';
2
2
 
3
3
  /**
4
- * Checks if two objects are the same L2BlockNew.
4
+ * Checks if two objects are the same L2Block.
5
5
  *
6
- * Sometimes we might be comparing two L2BlockNew instances that represent the same block but one of them might not have
6
+ * Sometimes we might be comparing two L2Block instances that represent the same block but one of them might not have
7
7
  * calculated and filled its `blockHash` property (which is computed on demand). This function ensures both objects
8
- * are really the same L2BlockNew.
8
+ * are really the same L2Block.
9
9
  *
10
10
  * @param a - An object
11
11
  * @param b - Another object
12
- * @returns True if both a and b are the same L2BlockNew
12
+ * @returns True if both a and b are the same L2Block
13
13
  */
14
14
  export function equalL2Blocks(a: any, b: any) {
15
- const aAsL2Block = a && a instanceof L2BlockNew ? a : undefined;
16
- const bAsL2Block = b && b instanceof L2BlockNew ? b : undefined;
15
+ const aAsL2Block = a && a instanceof L2Block ? a : undefined;
16
+ const bAsL2Block = b && b instanceof L2Block ? b : undefined;
17
17
 
18
18
  if (aAsL2Block && bAsL2Block) {
19
- // we got two L2BlockNew instances, so we can compare them
19
+ // we got two L2Block instances, so we can compare them
20
20
  // use a custom comparator because the blockHash property is lazily computed and one instance might not have it
21
21
  return aAsL2Block.toBuffer().equals(bAsL2Block.toBuffer());
22
22
  } else if (aAsL2Block || bAsL2Block) {
23
- // one value is an L2BlockNew and the other isn't. Definitely not equal.
23
+ // one value is an L2Block and the other isn't. Definitely not equal.
24
24
  return false;
25
25
  } else {
26
26
  // we don't know what they are, tell Jest to keep looking