@aztec/stdlib 0.0.1-commit.2ed92850 → 0.0.1-commit.3469e52

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 (108) hide show
  1. package/dest/block/block_hash.d.ts +2 -3
  2. package/dest/block/block_hash.d.ts.map +1 -1
  3. package/dest/block/block_hash.js +0 -3
  4. package/dest/block/checkpointed_l2_block.d.ts +6 -6
  5. package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
  6. package/dest/block/checkpointed_l2_block.js +3 -3
  7. package/dest/block/in_block.d.ts +3 -3
  8. package/dest/block/in_block.d.ts.map +1 -1
  9. package/dest/block/index.d.ts +2 -2
  10. package/dest/block/index.d.ts.map +1 -1
  11. package/dest/block/index.js +1 -1
  12. package/dest/block/{l2_block.d.ts → l2_block_new.d.ts} +6 -6
  13. package/dest/block/l2_block_new.d.ts.map +1 -0
  14. package/dest/block/{l2_block.js → l2_block_new.js} +11 -8
  15. package/dest/block/l2_block_source.d.ts +29 -37
  16. package/dest/block/l2_block_source.d.ts.map +1 -1
  17. package/dest/block/l2_block_stream/interfaces.d.ts +3 -3
  18. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  19. package/dest/block/l2_block_stream/l2_block_stream.d.ts +3 -2
  20. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  21. package/dest/block/l2_block_stream/l2_block_stream.js +4 -4
  22. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +3 -3
  23. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  24. package/dest/block/test/l2_tips_store_test_suite.js +2 -2
  25. package/dest/checkpoint/checkpoint.d.ts +8 -8
  26. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  27. package/dest/checkpoint/checkpoint.js +4 -4
  28. package/dest/checkpoint/published_checkpoint.d.ts +2 -2
  29. package/dest/config/node-rpc-config.js +1 -1
  30. package/dest/contract/private_function.d.ts +1 -1
  31. package/dest/contract/private_function.d.ts.map +1 -1
  32. package/dest/contract/private_function.js +2 -1
  33. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
  34. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
  35. package/dest/delayed_public_mutable/delayed_public_mutable_values.js +10 -7
  36. package/dest/epoch-helpers/index.js +1 -1
  37. package/dest/interfaces/archiver.d.ts +1 -1
  38. package/dest/interfaces/archiver.d.ts.map +1 -1
  39. package/dest/interfaces/archiver.js +15 -15
  40. package/dest/interfaces/aztec-node-admin.d.ts +1 -4
  41. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  42. package/dest/interfaces/aztec-node.d.ts +9 -23
  43. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  44. package/dest/interfaces/aztec-node.js +11 -11
  45. package/dest/interfaces/block-builder.d.ts +4 -4
  46. package/dest/interfaces/block-builder.d.ts.map +1 -1
  47. package/dest/interfaces/configs.d.ts +2 -2
  48. package/dest/interfaces/configs.d.ts.map +1 -1
  49. package/dest/interfaces/prover-client.d.ts +1 -10
  50. package/dest/interfaces/prover-client.d.ts.map +1 -1
  51. package/dest/interfaces/prover-client.js +1 -7
  52. package/dest/interfaces/tx_provider.d.ts +3 -3
  53. package/dest/interfaces/tx_provider.d.ts.map +1 -1
  54. package/dest/interfaces/validator.d.ts +2 -2
  55. package/dest/interfaces/validator.d.ts.map +1 -1
  56. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
  57. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
  58. package/dest/kernel/hints/build_nullifier_read_request_hints.js +6 -4
  59. package/dest/p2p/block_proposal.d.ts +4 -4
  60. package/dest/p2p/block_proposal.d.ts.map +1 -1
  61. package/dest/p2p/block_proposal.js +1 -1
  62. package/dest/p2p/message_validator.d.ts +3 -18
  63. package/dest/p2p/message_validator.d.ts.map +1 -1
  64. package/dest/p2p/message_validator.js +1 -2
  65. package/dest/tests/factories.js +1 -1
  66. package/dest/tests/jest.d.ts +4 -4
  67. package/dest/tests/jest.js +9 -9
  68. package/dest/tests/mocks.d.ts +9 -10
  69. package/dest/tests/mocks.d.ts.map +1 -1
  70. package/dest/tests/mocks.js +10 -15
  71. package/dest/tx/block_header.d.ts +2 -3
  72. package/dest/tx/block_header.d.ts.map +1 -1
  73. package/dest/tx/block_header.js +2 -3
  74. package/dest/tx/tx_receipt.d.ts +11 -39
  75. package/dest/tx/tx_receipt.d.ts.map +1 -1
  76. package/dest/tx/tx_receipt.js +13 -44
  77. package/package.json +9 -9
  78. package/src/block/block_hash.ts +1 -5
  79. package/src/block/checkpointed_l2_block.ts +4 -4
  80. package/src/block/in_block.ts +2 -2
  81. package/src/block/index.ts +1 -1
  82. package/src/block/{l2_block.ts → l2_block_new.ts} +13 -9
  83. package/src/block/l2_block_source.ts +30 -38
  84. package/src/block/l2_block_stream/interfaces.ts +2 -2
  85. package/src/block/l2_block_stream/l2_block_stream.ts +6 -5
  86. package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
  87. package/src/block/test/l2_tips_store_test_suite.ts +4 -4
  88. package/src/checkpoint/checkpoint.ts +7 -7
  89. package/src/config/node-rpc-config.ts +1 -1
  90. package/src/contract/private_function.ts +2 -1
  91. package/src/delayed_public_mutable/delayed_public_mutable_values.ts +10 -9
  92. package/src/epoch-helpers/index.ts +1 -1
  93. package/src/interfaces/archiver.ts +24 -15
  94. package/src/interfaces/aztec-node.ts +31 -38
  95. package/src/interfaces/block-builder.ts +3 -3
  96. package/src/interfaces/configs.ts +3 -1
  97. package/src/interfaces/prover-client.ts +0 -15
  98. package/src/interfaces/tx_provider.ts +2 -2
  99. package/src/interfaces/validator.ts +2 -1
  100. package/src/kernel/hints/build_nullifier_read_request_hints.ts +10 -1
  101. package/src/p2p/block_proposal.ts +3 -3
  102. package/src/p2p/message_validator.ts +2 -14
  103. package/src/tests/factories.ts +1 -1
  104. package/src/tests/jest.ts +9 -9
  105. package/src/tests/mocks.ts +13 -20
  106. package/src/tx/block_header.ts +4 -7
  107. package/src/tx/tx_receipt.ts +15 -72
  108. package/dest/block/l2_block.d.ts.map +0 -1
@@ -68,22 +68,23 @@ export class DelayedPublicMutableValues {
68
68
  }
69
69
 
70
70
  static async readFromTree(delayedPublicMutableSlot: Fr, readStorage: (storageSlot: Fr) => Promise<Fr>) {
71
- const fieldPromises = Array.from({ length: DELAYED_PUBLIC_MUTABLE_VALUES_LEN }).map((_, i) =>
72
- readStorage(delayedPublicMutableSlot.add(new Fr(i))),
73
- );
74
- return DelayedPublicMutableValues.fromFields(await Promise.all(fieldPromises));
71
+ const fields = [];
72
+ for (let i = 0; i < DELAYED_PUBLIC_MUTABLE_VALUES_LEN; i++) {
73
+ fields.push(await readStorage(delayedPublicMutableSlot.add(new Fr(i))));
74
+ }
75
+ return DelayedPublicMutableValues.fromFields(fields);
75
76
  }
76
77
 
77
78
  isEmpty(): boolean {
78
79
  return this.svc.isEmpty() && this.sdc.isEmpty();
79
80
  }
80
81
 
81
- writeToTree(delayedPublicMutableSlot: Fr, storageWrite: (storageSlot: Fr, value: Fr) => Promise<void>) {
82
- const fieldPromises = this.toFields().map((field, i) =>
83
- storageWrite(delayedPublicMutableSlot.add(new Fr(i)), field),
84
- );
82
+ async writeToTree(delayedPublicMutableSlot: Fr, storageWrite: (storageSlot: Fr, value: Fr) => Promise<void>) {
83
+ const fields = this.toFields();
85
84
 
86
- return Promise.all(fieldPromises);
85
+ for (let i = 0; i < fields.length; i++) {
86
+ await storageWrite(delayedPublicMutableSlot.add(new Fr(i)), fields[i]);
87
+ }
87
88
  }
88
89
 
89
90
  async hash(): Promise<Fr> {
@@ -69,7 +69,7 @@ export function getSlotRangeForEpoch(
69
69
  epochNumber: EpochNumber,
70
70
  constants: Pick<L1RollupConstants, 'epochDuration'>,
71
71
  ): [SlotNumber, SlotNumber] {
72
- const startSlot = SlotNumber(Number(epochNumber) * constants.epochDuration);
72
+ const startSlot = SlotNumber(epochNumber * constants.epochDuration);
73
73
  return [startSlot, SlotNumber(startSlot + constants.epochDuration - 1)];
74
74
  }
75
75
 
@@ -5,7 +5,7 @@ import type { ApiSchemaFor } from '@aztec/foundation/schemas';
5
5
  import { z } from 'zod';
6
6
 
7
7
  import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
8
- import { L2Block } from '../block/l2_block.js';
8
+ import { L2BlockNew } from '../block/l2_block_new.js';
9
9
  import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
10
10
  import { ValidateCheckpointResultSchema } from '../block/validate_block_result.js';
11
11
  import { Checkpoint } from '../checkpoint/checkpoint.js';
@@ -82,9 +82,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
82
82
  getRegistryAddress: z.function().args().returns(schemas.EthAddress),
83
83
  getBlockNumber: z.function().args().returns(BlockNumberSchema),
84
84
  getProvenBlockNumber: z.function().args().returns(BlockNumberSchema),
85
- getCheckpointedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
86
- getFinalizedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
87
- getBlock: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
85
+ getBlock: z.function().args(BlockNumberSchema).returns(L2BlockNew.schema.optional()),
88
86
  getBlockHeader: z
89
87
  .function()
90
88
  .args(z.union([BlockNumberSchema, z.literal('latest')]))
@@ -92,28 +90,39 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
92
90
  getCheckpointedBlock: z.function().args(BlockNumberSchema).returns(CheckpointedL2Block.schema.optional()),
93
91
  getCheckpointedBlocks: z
94
92
  .function()
95
- .args(BlockNumberSchema, schemas.Integer)
93
+ .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
96
94
  .returns(z.array(CheckpointedL2Block.schema)),
97
- getBlocks: z.function().args(BlockNumberSchema, schemas.Integer).returns(z.array(L2Block.schema)),
98
- getCheckpoints: z
95
+ getBlocks: z
96
+ .function()
97
+ .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
98
+ .returns(z.array(L2BlockNew.schema)),
99
+ getPublishedCheckpoints: z
99
100
  .function()
100
101
  .args(CheckpointNumberSchema, schemas.Integer)
101
102
  .returns(z.array(PublishedCheckpoint.schema)),
102
- getCheckpointedBlockByHash: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
103
- getCheckpointedBlockByArchive: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
103
+ getPublishedBlocks: z
104
+ .function()
105
+ .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
106
+ .returns(z.array(CheckpointedL2Block.schema)),
107
+ getL2BlocksNew: z
108
+ .function()
109
+ .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
110
+ .returns(z.array(L2BlockNew.schema)),
111
+ getPublishedBlockByHash: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
112
+ getPublishedBlockByArchive: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
104
113
  getBlockHeaderByHash: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
105
114
  getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
106
- getL2Block: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
107
- getL2BlockByHash: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
108
- getL2BlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
115
+ getL2BlockNew: z.function().args(BlockNumberSchema).returns(L2BlockNew.schema.optional()),
116
+ getL2BlockNewByHash: z.function().args(schemas.Fr).returns(L2BlockNew.schema.optional()),
117
+ getL2BlockNewByArchive: z.function().args(schemas.Fr).returns(L2BlockNew.schema.optional()),
109
118
  getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
110
119
  getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
111
120
  getL2SlotNumber: z.function().args().returns(schemas.SlotNumber.optional()),
112
121
  getL2EpochNumber: z.function().args().returns(EpochNumberSchema.optional()),
113
122
  getCheckpointsForEpoch: z.function().args(EpochNumberSchema).returns(z.array(Checkpoint.schema)),
114
- getCheckpointedBlocksForEpoch: z.function().args(EpochNumberSchema).returns(z.array(CheckpointedL2Block.schema)),
115
- getBlocksForSlot: z.function().args(schemas.SlotNumber).returns(z.array(L2Block.schema)),
116
- getCheckpointedBlockHeadersForEpoch: z.function().args(EpochNumberSchema).returns(z.array(BlockHeader.schema)),
123
+ getBlocksForEpoch: z.function().args(EpochNumberSchema).returns(z.array(L2BlockNew.schema)),
124
+ getBlocksForSlot: z.function().args(schemas.SlotNumber).returns(z.array(L2BlockNew.schema)),
125
+ getBlockHeadersForEpoch: z.function().args(EpochNumberSchema).returns(z.array(BlockHeader.schema)),
117
126
  isEpochComplete: z.function().args(EpochNumberSchema).returns(z.boolean()),
118
127
  getL2Tips: z.function().args().returns(L2TipsSchema),
119
128
  getPrivateLogsByTags: z
@@ -23,11 +23,10 @@ import { MembershipWitness, SiblingPath } from '@aztec/foundation/trees';
23
23
  import { z } from 'zod';
24
24
 
25
25
  import type { AztecAddress } from '../aztec-address/index.js';
26
- import { L2BlockHash } from '../block/block_hash.js';
27
26
  import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
28
27
  import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
29
28
  import { type DataInBlock, dataInBlockSchemaFor } from '../block/in_block.js';
30
- import { L2Block } from '../block/l2_block.js';
29
+ import { L2BlockNew } from '../block/l2_block_new.js';
31
30
  import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
32
31
  import { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
33
32
  import {
@@ -78,7 +77,13 @@ import { type WorldStateSyncStatus, WorldStateSyncStatusSchema } from './world_s
78
77
  export interface AztecNode
79
78
  extends Pick<
80
79
  L2BlockSource,
81
- 'getBlocks' | 'getCheckpoints' | 'getBlockHeader' | 'getL2Tips' | 'getCheckpointedBlocks'
80
+ | 'getBlocks'
81
+ | 'getL2BlocksNew'
82
+ | 'getPublishedBlocks'
83
+ | 'getPublishedCheckpoints'
84
+ | 'getBlockHeader'
85
+ | 'getL2Tips'
86
+ | 'getCheckpointedBlocks'
82
87
  > {
83
88
  /**
84
89
  * Returns the tips of the L2 chain.
@@ -227,21 +232,21 @@ export interface AztecNode
227
232
  * @param number - The block number or 'latest'.
228
233
  * @returns The requested block.
229
234
  */
230
- getBlock(number: BlockParameter): Promise<L2Block | undefined>;
235
+ getBlock(number: BlockParameter): Promise<L2BlockNew | undefined>;
231
236
 
232
237
  /**
233
238
  * Get a block specified by its hash.
234
239
  * @param blockHash - The block hash being requested.
235
240
  * @returns The requested block.
236
241
  */
237
- getBlockByHash(blockHash: Fr): Promise<L2Block | undefined>;
242
+ getBlockByHash(blockHash: Fr): Promise<L2BlockNew | undefined>;
238
243
 
239
244
  /**
240
245
  * Get a block specified by its archive root.
241
246
  * @param archive - The archive root being requested.
242
247
  * @returns The requested block.
243
248
  */
244
- getBlockByArchive(archive: Fr): Promise<L2Block | undefined>;
249
+ getBlockByArchive(archive: Fr): Promise<L2BlockNew | undefined>;
245
250
 
246
251
  /**
247
252
  * Method to fetch the latest block number synchronized by the node.
@@ -255,12 +260,6 @@ export interface AztecNode
255
260
  */
256
261
  getProvenBlockNumber(): Promise<BlockNumber>;
257
262
 
258
- /**
259
- * Fetches the latest checkpointed block number.
260
- * @returns The block number.
261
- */
262
- getCheckpointedBlockNumber(): Promise<BlockNumber>;
263
-
264
263
  /**
265
264
  * Method to determine if the node is ready to accept transactions.
266
265
  * @returns - Flag indicating the readiness for tx submission.
@@ -280,7 +279,7 @@ export interface AztecNode
280
279
  * @param limit - The maximum number of blocks to return.
281
280
  * @returns The blocks requested.
282
281
  */
283
- getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
282
+ getBlocks(from: BlockNumber, limit: number): Promise<L2BlockNew[]>;
284
283
 
285
284
  /**
286
285
  * Method to fetch the current min fees.
@@ -348,14 +347,10 @@ export interface AztecNode
348
347
  * array implies no logs match that tag.
349
348
  * @param tags - The tags to search for.
350
349
  * @param page - The page number (0-indexed) for pagination.
351
- * @param referenceBlock - Optional block hash used to ensure the block still exists before logs are retrieved.
352
- * This block is expected to represent the latest block to which the client has synced (called anchor block in PXE).
353
- * If specified and the block is not found, an error is thrown. This helps detect reorgs, which could result in
354
- * undefined behavior in the client's code.
355
350
  * @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
356
351
  * for a tag, the caller should fetch the next page to check for more logs.
357
352
  */
358
- getPrivateLogsByTags(tags: SiloedTag[], page?: number, referenceBlock?: L2BlockHash): Promise<TxScopedL2Log[][]>;
353
+ getPrivateLogsByTags(tags: SiloedTag[], page?: number): Promise<TxScopedL2Log[][]>;
359
354
 
360
355
  /**
361
356
  * Gets public logs that match any of the `tags` from the specified contract. For each tag, an array of matching
@@ -363,10 +358,6 @@ export interface AztecNode
363
358
  * @param contractAddress - The contract address to search logs for.
364
359
  * @param tags - The tags to search for.
365
360
  * @param page - The page number (0-indexed) for pagination.
366
- * @param referenceBlock - Optional block hash used to ensure the block still exists before logs are retrieved.
367
- * This block is expected to represent the latest block to which the client has synced (called anchor block in PXE).
368
- * If specified and the block is not found, an error is thrown. This helps detect reorgs, which could result in
369
- * undefined behavior in the client's code.
370
361
  * @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
371
362
  * for a tag, the caller should fetch the next page to check for more logs.
372
363
  */
@@ -374,7 +365,6 @@ export interface AztecNode
374
365
  contractAddress: AztecAddress,
375
366
  tags: Tag[],
376
367
  page?: number,
377
- referenceBlock?: L2BlockHash,
378
368
  ): Promise<TxScopedL2Log[][]>;
379
369
 
380
370
  /**
@@ -577,18 +567,16 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
577
567
  .args(EpochNumberSchema)
578
568
  .returns(z.array(z.array(z.array(z.array(schemas.Fr))))),
579
569
 
580
- getBlock: z.function().args(BlockParameterSchema).returns(L2Block.schema.optional()),
570
+ getBlock: z.function().args(BlockParameterSchema).returns(L2BlockNew.schema.optional()),
581
571
 
582
- getBlockByHash: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
572
+ getBlockByHash: z.function().args(schemas.Fr).returns(L2BlockNew.schema.optional()),
583
573
 
584
- getBlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
574
+ getBlockByArchive: z.function().args(schemas.Fr).returns(L2BlockNew.schema.optional()),
585
575
 
586
576
  getBlockNumber: z.function().returns(BlockNumberSchema),
587
577
 
588
578
  getProvenBlockNumber: z.function().returns(BlockNumberSchema),
589
579
 
590
- getCheckpointedBlockNumber: z.function().returns(BlockNumberSchema),
591
-
592
580
  isReady: z.function().returns(z.boolean()),
593
581
 
594
582
  getNodeInfo: z.function().returns(NodeInfoSchema),
@@ -596,16 +584,26 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
596
584
  getBlocks: z
597
585
  .function()
598
586
  .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
599
- .returns(z.array(L2Block.schema)),
587
+ .returns(z.array(L2BlockNew.schema)),
600
588
 
601
- getCheckpoints: z
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
602
595
  .function()
603
596
  .args(CheckpointNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_CHECKPOINTS_LEN))
604
597
  .returns(z.array(PublishedCheckpoint.schema)),
605
598
 
606
- getCheckpointedBlocks: z
599
+ getL2BlocksNew: z
607
600
  .function()
608
601
  .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
602
+ .returns(z.array(L2BlockNew.schema)),
603
+
604
+ getCheckpointedBlocks: z
605
+ .function()
606
+ .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN), optional(z.boolean()))
609
607
  .returns(z.array(CheckpointedL2Block.schema)),
610
608
 
611
609
  getCurrentMinFees: z.function().returns(GasFees.schema),
@@ -633,17 +631,12 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
633
631
 
634
632
  getPrivateLogsByTags: z
635
633
  .function()
636
- .args(z.array(SiloedTag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)), optional(L2BlockHash.schema))
634
+ .args(z.array(SiloedTag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)))
637
635
  .returns(z.array(z.array(TxScopedL2Log.schema))),
638
636
 
639
637
  getPublicLogsByTagsFromContract: z
640
638
  .function()
641
- .args(
642
- schemas.AztecAddress,
643
- z.array(Tag.schema).max(MAX_RPC_LEN),
644
- optional(z.number().gte(0)),
645
- optional(L2BlockHash.schema),
646
- )
639
+ .args(schemas.AztecAddress, z.array(Tag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)))
647
640
  .returns(z.array(z.array(TxScopedL2Log.schema))),
648
641
 
649
642
  sendTx: z.function().args(Tx.schema).returns(z.void()),
@@ -1,7 +1,7 @@
1
1
  import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
2
2
  import type { Fr } from '@aztec/foundation/curves/bn254';
3
3
 
4
- import type { L2Block } from '../block/l2_block.js';
4
+ import type { L2BlockNew } from '../block/l2_block_new.js';
5
5
  import type { ChainConfig, SequencerConfig } from '../config/chain-config.js';
6
6
  import type { L1RollupConstants } from '../epoch-helpers/index.js';
7
7
  import type { Gas } from '../gas/gas.js';
@@ -31,7 +31,7 @@ export interface IBlockFactory extends ProcessedTxHandler {
31
31
  /**
32
32
  * Assembles the block and updates the archive tree.
33
33
  */
34
- setBlockCompleted(expectedBlockHeader?: BlockHeader): Promise<L2Block>;
34
+ setBlockCompleted(expectedBlockHeader?: BlockHeader): Promise<L2BlockNew>;
35
35
  }
36
36
 
37
37
  export interface PublicProcessorLimits {
@@ -63,7 +63,7 @@ export const FullNodeBlockBuilderConfigKeys: (keyof FullNodeBlockBuilderConfig)[
63
63
 
64
64
  /** Result of building a block within a checkpoint. */
65
65
  export interface BuildBlockInCheckpointResult {
66
- block: L2Block;
66
+ block: L2BlockNew;
67
67
  publicGas: Gas;
68
68
  publicProcessorDuration: number;
69
69
  numTxs: number;
@@ -67,7 +67,9 @@ 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
- /** Skip pushing proposed blocks to archiver (default: false) */
70
+
71
+ // TODO(palla/mbps): Change default to false once block sync is stable
72
+ /** Skip pushing proposed blocks to archiver (default: true) */
71
73
  skipPushProposedBlocksToArchiver?: boolean;
72
74
  }
73
75
 
@@ -17,12 +17,6 @@ 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;
26
20
  };
27
21
 
28
22
  /**
@@ -49,7 +43,6 @@ export const ProverConfigSchema = zodFor<ProverConfig>()(
49
43
  proverTestDelayFactor: z.number(),
50
44
  proverAgentCount: z.number(),
51
45
  failedProofStore: z.string().optional(),
52
- cancelJobsOnStop: z.boolean(),
53
46
  }),
54
47
  );
55
48
 
@@ -92,14 +85,6 @@ export const proverConfigMappings: ConfigMappingsType<ProverConfig> = {
92
85
  description:
93
86
  'Store for failed proof inputs. Google cloud storage is only supported at the moment. Set this value as gs://bucket-name/path/to/store.',
94
87
  },
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
- },
103
88
  };
104
89
 
105
90
  function parseProverId(str?: string) {
@@ -1,4 +1,4 @@
1
- import type { L2Block } from '@aztec/stdlib/block';
1
+ import type { L2BlockNew } 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: L2Block, opts: { deadline: Date }): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
16
+ getTxsForBlock(block: L2BlockNew, opts: { deadline: Date }): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
17
17
  }
@@ -55,7 +55,8 @@ export type ValidatorClientConfig = ValidatorHASignerConfig & {
55
55
  /** Skip checkpoint proposal validation and always attest (default: true) */
56
56
  skipCheckpointProposalValidation?: boolean;
57
57
 
58
- /** Skip pushing re-executed blocks to archiver (default: false) */
58
+ // TODO(palla/mbps): Change default to false once block sync is stable
59
+ /** Skip pushing re-executed blocks to archiver (default: true) */
59
60
  skipPushProposedBlocksToArchiver?: boolean;
60
61
  };
61
62
 
@@ -6,6 +6,7 @@ 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';
9
10
  import type { NullifierLeafPreimage } from '../../trees/nullifier_leaf.js';
10
11
  import type { ClaimedLengthArray } from '../claimed_length_array.js';
11
12
  import type { ScopedNullifier } from '../nullifier.js';
@@ -73,6 +74,7 @@ export async function buildNullifierReadRequestHintsFromResetActions<PENDING ext
73
74
  resetActions: ReadRequestResetActions<typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>,
74
75
  maxPending: PENDING = MAX_NULLIFIER_READ_REQUESTS_PER_TX as PENDING,
75
76
  maxSettled: SETTLED = MAX_NULLIFIER_READ_REQUESTS_PER_TX as SETTLED,
77
+ siloed = false,
76
78
  ) {
77
79
  const builder = new NullifierReadRequestHintsBuilder(maxPending, maxSettled);
78
80
 
@@ -88,7 +90,12 @@ export async function buildNullifierReadRequestHintsFromResetActions<PENDING ext
88
90
  }
89
91
  }
90
92
 
91
- const siloedValues = settledRequests.map(({ readRequest }) => readRequest.value);
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
+ );
92
99
 
93
100
  // Fetch all membership witnesses in parallel
94
101
  const membershipWitnesses = await Promise.all(siloedValues.map(value => oracle.getNullifierMembershipWitness(value)));
@@ -114,6 +121,7 @@ export async function buildNullifierReadRequestHints<PENDING extends number, SET
114
121
  futureNullifiers: ScopedNullifier[],
115
122
  maxPending: PENDING = MAX_NULLIFIER_READ_REQUESTS_PER_TX as PENDING,
116
123
  maxSettled: SETTLED = MAX_NULLIFIER_READ_REQUESTS_PER_TX as SETTLED,
124
+ siloed = false,
117
125
  ) {
118
126
  const resetActions = getNullifierReadRequestResetActions(nullifierReadRequests, nullifiers, futureNullifiers);
119
127
  return await buildNullifierReadRequestHintsFromResetActions(
@@ -122,5 +130,6 @@ export async function buildNullifierReadRequestHints<PENDING extends number, SET
122
130
  resetActions,
123
131
  maxPending,
124
132
  maxSettled,
133
+ siloed,
125
134
  );
126
135
  }
@@ -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';
12
11
  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';
@@ -284,10 +284,10 @@ export class BlockProposal extends Gossipable {
284
284
  /**
285
285
  * Check if this proposal matches the given block.
286
286
  * Compares the archive root and block header.
287
- * @param block - The L2Block to compare against
287
+ * @param block - The L2BlockNew to compare against
288
288
  * @returns True if the proposal matches the block
289
289
  */
290
- matchesBlock(block: L2Block): boolean {
290
+ matchesBlock(block: L2BlockNew): boolean {
291
291
  return this.archiveRoot.equals(block.archive.root) && this.blockHeader.equals(block.header);
292
292
  }
293
293
 
@@ -1,22 +1,10 @@
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
-
14
3
  /**
15
4
  * P2PValidator
16
5
  *
17
- * A validator for P2P messages, which returns a ValidationResult indicating
18
- * whether to accept, ignore, or reject the message
6
+ * A validator for P2P messages, which returns a severity of error to be applied to the peer
19
7
  */
20
8
  export interface P2PValidator<T> {
21
- validate(message: T): Promise<ValidationResult>;
9
+ validate(message: T): Promise<PeerErrorSeverity | undefined>;
22
10
  }
@@ -1739,7 +1739,7 @@ export function makeL2Tips(
1739
1739
  ? typeof checkpointNumber === 'number'
1740
1740
  ? CheckpointNumber(checkpointNumber)
1741
1741
  : checkpointNumber
1742
- : CheckpointNumber.fromBlockNumber(bn);
1742
+ : CheckpointNumber(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 { L2Block } from '../block/l2_block.js';
1
+ import { L2BlockNew } from '../block/l2_block_new.js';
2
2
 
3
3
  /**
4
- * Checks if two objects are the same L2Block.
4
+ * Checks if two objects are the same L2BlockNew.
5
5
  *
6
- * Sometimes we might be comparing two L2Block instances that represent the same block but one of them might not have
6
+ * Sometimes we might be comparing two L2BlockNew 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 L2Block.
8
+ * are really the same L2BlockNew.
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 L2Block
12
+ * @returns True if both a and b are the same L2BlockNew
13
13
  */
14
14
  export function equalL2Blocks(a: any, b: any) {
15
- const aAsL2Block = a && a instanceof L2Block ? a : undefined;
16
- const bAsL2Block = b && b instanceof L2Block ? b : undefined;
15
+ const aAsL2Block = a && a instanceof L2BlockNew ? a : undefined;
16
+ const bAsL2Block = b && b instanceof L2BlockNew ? b : undefined;
17
17
 
18
18
  if (aAsL2Block && bAsL2Block) {
19
- // we got two L2Block instances, so we can compare them
19
+ // we got two L2BlockNew 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 L2Block and the other isn't. Definitely not equal.
23
+ // one value is an L2BlockNew 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
@@ -22,7 +22,7 @@ import { AvmCircuitPublicInputs } from '../avm/avm_circuit_public_inputs.js';
22
22
  import { PublicDataWrite } from '../avm/public_data_write.js';
23
23
  import { RevertCode } from '../avm/revert_code.js';
24
24
  import { AztecAddress } from '../aztec-address/index.js';
25
- import { CheckpointedL2Block, CommitteeAttestation, L2Block } from '../block/index.js';
25
+ import { CheckpointedL2Block, CommitteeAttestation, L2BlockNew } from '../block/index.js';
26
26
  import type { CommitteeAttestationsAndSigners } from '../block/proposal/attestations_and_signers.js';
27
27
  import { Checkpoint } from '../checkpoint/checkpoint.js';
28
28
  import { L1PublishedData } from '../checkpoint/published_checkpoint.js';
@@ -404,37 +404,32 @@ export async function mockCheckpointAndMessages(
404
404
  numL1ToL2Messages = 1,
405
405
  makeBlockOptions = () => ({}),
406
406
  previousArchive,
407
- maxEffects,
408
407
  ...options
409
408
  }: {
410
409
  startBlockNumber?: BlockNumber;
411
410
  numBlocks?: number;
412
411
  numTxsPerBlock?: number;
413
412
  numL1ToL2Messages?: number;
414
- makeBlockOptions?: (blockNumber: BlockNumber) => Partial<Parameters<typeof L2Block.random>[1]>;
413
+ makeBlockOptions?: (blockNumber: BlockNumber) => Partial<Parameters<typeof L2BlockNew.random>[1]>;
415
414
  previousArchive?: AppendOnlyTreeSnapshot;
416
- blocks?: L2Block[];
417
- maxEffects?: number;
415
+ blocks?: L2BlockNew[];
418
416
  } & Partial<Parameters<typeof Checkpoint.random>[1]> &
419
- Partial<Parameters<typeof L2Block.random>[1]> = {},
417
+ Partial<Parameters<typeof L2BlockNew.random>[1]> = {},
420
418
  ) {
421
- const slotNumber = options.slotNumber ?? SlotNumber(Number(checkpointNumber) * 10);
419
+ const slotNumber = options.slotNumber ?? SlotNumber(checkpointNumber * 10);
422
420
  const blocksAndMessages = [];
423
421
  // Track the previous block's archive to ensure consecutive blocks have consistent archive roots.
424
422
  // The current block's header.lastArchive must equal the previous block's archive.
425
423
  let lastArchive: AppendOnlyTreeSnapshot | undefined = previousArchive;
426
- // Pass maxEffects via txOptions so it reaches TxEffect.random
427
- const txOptions = maxEffects !== undefined ? { maxEffects } : {};
428
424
  for (let i = 0; i < (blocks?.length ?? numBlocks); i++) {
429
425
  const blockNumber = BlockNumber(startBlockNumber + i);
430
426
  const { block, messages } = {
431
427
  block:
432
428
  blocks?.[i] ??
433
- (await L2Block.random(blockNumber, {
429
+ (await L2BlockNew.random(blockNumber, {
434
430
  checkpointNumber,
435
431
  indexWithinCheckpoint: IndexWithinCheckpoint(i),
436
432
  txsPerBlock: numTxsPerBlock,
437
- txOptions,
438
433
  slotNumber,
439
434
  ...options,
440
435
  ...makeBlockOptions(blockNumber),
@@ -675,15 +670,15 @@ export const makeCheckpointAttestationFromCheckpoint = (
675
670
  };
676
671
 
677
672
  /**
678
- * Create a checkpoint attestation from an L2Block
679
- * Note: This is a compatibility function for tests. L2Block doesn't have a checkpoint header directly.
673
+ * Create a checkpoint attestation from an L2BlockNew
674
+ * Note: This is a compatibility function for tests. L2BlockNew doesn't have a checkpoint header directly.
680
675
  */
681
676
  export const makeCheckpointAttestationFromBlock = (
682
- block: L2Block,
677
+ block: L2BlockNew,
683
678
  attesterSigner?: Secp256k1Signer,
684
679
  proposerSigner?: Secp256k1Signer,
685
680
  ): CheckpointAttestation => {
686
- // For L2Block, we create a minimal checkpoint header for testing purposes
681
+ // For L2BlockNew, we create a minimal checkpoint header for testing purposes
687
682
  const header = CheckpointHeader.empty({
688
683
  lastArchiveRoot: block.header.lastArchive.root,
689
684
  slotNumber: block.slot,
@@ -699,7 +694,7 @@ export async function randomPublishedL2Block(
699
694
  l2BlockNumber: number,
700
695
  opts: { signers?: Secp256k1Signer[] } = {},
701
696
  ): Promise<CheckpointedL2Block> {
702
- const block = await L2Block.random(BlockNumber(l2BlockNumber));
697
+ const block = await L2BlockNew.random(BlockNumber(l2BlockNumber));
703
698
  const l1 = L1PublishedData.fromFields({
704
699
  blockNumber: BigInt(block.number),
705
700
  timestamp: block.header.globalVariables.timestamp,
@@ -707,9 +702,7 @@ export async function randomPublishedL2Block(
707
702
  });
708
703
 
709
704
  const signers = opts.signers ?? times(3, () => Secp256k1Signer.random());
710
- const checkpoint = await Checkpoint.random(CheckpointNumber.fromBlockNumber(BlockNumber(l2BlockNumber)), {
711
- numBlocks: 0,
712
- });
705
+ const checkpoint = await Checkpoint.random(CheckpointNumber(l2BlockNumber), { numBlocks: 0 });
713
706
  checkpoint.blocks = [block];
714
707
  const atts = signers.map(signer =>
715
708
  makeCheckpointAttestation({
@@ -721,5 +714,5 @@ export async function randomPublishedL2Block(
721
714
  const attestations = atts.map(
722
715
  (attestation, i) => new CommitteeAttestation(signers[i].address, attestation.signature),
723
716
  );
724
- return new CheckpointedL2Block(CheckpointNumber.fromBlockNumber(BlockNumber(l2BlockNumber)), block, l1, attestations);
717
+ return new CheckpointedL2Block(CheckpointNumber(l2BlockNumber), block, l1, attestations);
725
718
  }