@aztec/stdlib 4.0.0-nightly.20260122 → 4.0.0-nightly.20260124

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 (88) hide show
  1. package/dest/block/checkpointed_l2_block.d.ts +6 -6
  2. package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
  3. package/dest/block/checkpointed_l2_block.js +3 -3
  4. package/dest/block/in_block.d.ts +3 -3
  5. package/dest/block/in_block.d.ts.map +1 -1
  6. package/dest/block/index.d.ts +2 -2
  7. package/dest/block/index.d.ts.map +1 -1
  8. package/dest/block/index.js +1 -1
  9. package/dest/block/{l2_block_new.d.ts → l2_block.d.ts} +6 -6
  10. package/dest/block/l2_block.d.ts.map +1 -0
  11. package/dest/block/{l2_block_new.js → l2_block.js} +5 -9
  12. package/dest/block/l2_block_source.d.ts +25 -29
  13. package/dest/block/l2_block_source.d.ts.map +1 -1
  14. package/dest/block/l2_block_stream/interfaces.d.ts +3 -3
  15. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  16. package/dest/block/l2_block_stream/l2_block_stream.d.ts +2 -3
  17. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  18. package/dest/block/l2_block_stream/l2_block_stream.js +4 -4
  19. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +3 -3
  20. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  21. package/dest/block/test/l2_tips_store_test_suite.js +2 -2
  22. package/dest/checkpoint/checkpoint.d.ts +8 -8
  23. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  24. package/dest/checkpoint/checkpoint.js +4 -4
  25. package/dest/checkpoint/published_checkpoint.d.ts +2 -2
  26. package/dest/contract/private_function.d.ts +1 -1
  27. package/dest/contract/private_function.d.ts.map +1 -1
  28. package/dest/contract/private_function.js +1 -2
  29. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
  30. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
  31. package/dest/delayed_public_mutable/delayed_public_mutable_values.js +7 -10
  32. package/dest/epoch-helpers/index.js +1 -1
  33. package/dest/interfaces/archiver.d.ts +1 -1
  34. package/dest/interfaces/archiver.d.ts.map +1 -1
  35. package/dest/interfaces/archiver.js +13 -15
  36. package/dest/interfaces/aztec-node.d.ts +23 -9
  37. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  38. package/dest/interfaces/aztec-node.js +11 -11
  39. package/dest/interfaces/block-builder.d.ts +4 -4
  40. package/dest/interfaces/block-builder.d.ts.map +1 -1
  41. package/dest/interfaces/configs.d.ts +2 -2
  42. package/dest/interfaces/configs.d.ts.map +1 -1
  43. package/dest/interfaces/tx_provider.d.ts +3 -3
  44. package/dest/interfaces/tx_provider.d.ts.map +1 -1
  45. package/dest/interfaces/validator.d.ts +2 -2
  46. package/dest/interfaces/validator.d.ts.map +1 -1
  47. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
  48. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
  49. package/dest/kernel/hints/build_nullifier_read_request_hints.js +4 -6
  50. package/dest/p2p/block_proposal.d.ts +4 -4
  51. package/dest/p2p/block_proposal.d.ts.map +1 -1
  52. package/dest/p2p/block_proposal.js +1 -1
  53. package/dest/p2p/message_validator.d.ts +18 -3
  54. package/dest/p2p/message_validator.d.ts.map +1 -1
  55. package/dest/p2p/message_validator.js +2 -1
  56. package/dest/tests/factories.js +1 -1
  57. package/dest/tests/jest.d.ts +4 -4
  58. package/dest/tests/jest.js +9 -9
  59. package/dest/tests/mocks.d.ts +10 -9
  60. package/dest/tests/mocks.d.ts.map +1 -1
  61. package/dest/tests/mocks.js +15 -10
  62. package/package.json +9 -9
  63. package/src/block/checkpointed_l2_block.ts +4 -4
  64. package/src/block/in_block.ts +2 -2
  65. package/src/block/index.ts +1 -1
  66. package/src/block/{l2_block_new.ts → l2_block.ts} +6 -11
  67. package/src/block/l2_block_source.ts +24 -30
  68. package/src/block/l2_block_stream/interfaces.ts +2 -2
  69. package/src/block/l2_block_stream/l2_block_stream.ts +5 -6
  70. package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
  71. package/src/block/test/l2_tips_store_test_suite.ts +4 -4
  72. package/src/checkpoint/checkpoint.ts +7 -7
  73. package/src/contract/private_function.ts +1 -2
  74. package/src/delayed_public_mutable/delayed_public_mutable_values.ts +9 -10
  75. package/src/epoch-helpers/index.ts +1 -1
  76. package/src/interfaces/archiver.ts +13 -24
  77. package/src/interfaces/aztec-node.ts +38 -31
  78. package/src/interfaces/block-builder.ts +3 -3
  79. package/src/interfaces/configs.ts +1 -3
  80. package/src/interfaces/tx_provider.ts +2 -2
  81. package/src/interfaces/validator.ts +1 -2
  82. package/src/kernel/hints/build_nullifier_read_request_hints.ts +1 -10
  83. package/src/p2p/block_proposal.ts +3 -3
  84. package/src/p2p/message_validator.ts +14 -2
  85. package/src/tests/factories.ts +1 -1
  86. package/src/tests/jest.ts +9 -9
  87. package/src/tests/mocks.ts +20 -13
  88. package/dest/block/l2_block_new.d.ts.map +0 -1
@@ -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 { L2BlockNew } from '../block/l2_block_new.js';
8
+ import { L2Block } from '../block/l2_block.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';
@@ -84,7 +84,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
84
84
  getProvenBlockNumber: z.function().args().returns(BlockNumberSchema),
85
85
  getCheckpointedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
86
86
  getFinalizedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
87
- getBlock: z.function().args(BlockNumberSchema).returns(L2BlockNew.schema.optional()),
87
+ getBlock: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
88
88
  getBlockHeader: z
89
89
  .function()
90
90
  .args(z.union([BlockNumberSchema, z.literal('latest')]))
@@ -92,39 +92,28 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
92
92
  getCheckpointedBlock: z.function().args(BlockNumberSchema).returns(CheckpointedL2Block.schema.optional()),
93
93
  getCheckpointedBlocks: z
94
94
  .function()
95
- .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
95
+ .args(BlockNumberSchema, schemas.Integer)
96
96
  .returns(z.array(CheckpointedL2Block.schema)),
97
- getBlocks: z
98
- .function()
99
- .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
100
- .returns(z.array(L2BlockNew.schema)),
101
- getPublishedCheckpoints: z
97
+ getBlocks: z.function().args(BlockNumberSchema, schemas.Integer).returns(z.array(L2Block.schema)),
98
+ getCheckpoints: z
102
99
  .function()
103
100
  .args(CheckpointNumberSchema, schemas.Integer)
104
101
  .returns(z.array(PublishedCheckpoint.schema)),
105
- getPublishedBlocks: z
106
- .function()
107
- .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
108
- .returns(z.array(CheckpointedL2Block.schema)),
109
- getL2BlocksNew: z
110
- .function()
111
- .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
112
- .returns(z.array(L2BlockNew.schema)),
113
- getPublishedBlockByHash: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
114
- getPublishedBlockByArchive: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
102
+ getCheckpointedBlockByHash: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
103
+ getCheckpointedBlockByArchive: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
115
104
  getBlockHeaderByHash: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
116
105
  getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
117
- getL2BlockNew: z.function().args(BlockNumberSchema).returns(L2BlockNew.schema.optional()),
118
- getL2BlockNewByHash: z.function().args(schemas.Fr).returns(L2BlockNew.schema.optional()),
119
- getL2BlockNewByArchive: z.function().args(schemas.Fr).returns(L2BlockNew.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()),
120
109
  getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
121
110
  getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
122
111
  getL2SlotNumber: z.function().args().returns(schemas.SlotNumber.optional()),
123
112
  getL2EpochNumber: z.function().args().returns(EpochNumberSchema.optional()),
124
113
  getCheckpointsForEpoch: z.function().args(EpochNumberSchema).returns(z.array(Checkpoint.schema)),
125
- getBlocksForEpoch: z.function().args(EpochNumberSchema).returns(z.array(L2BlockNew.schema)),
126
- getBlocksForSlot: z.function().args(schemas.SlotNumber).returns(z.array(L2BlockNew.schema)),
127
- getBlockHeadersForEpoch: z.function().args(EpochNumberSchema).returns(z.array(BlockHeader.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)),
128
117
  isEpochComplete: z.function().args(EpochNumberSchema).returns(z.boolean()),
129
118
  getL2Tips: z.function().args().returns(L2TipsSchema),
130
119
  getPrivateLogsByTags: z
@@ -23,10 +23,11 @@ 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';
26
27
  import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
27
28
  import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
28
29
  import { type DataInBlock, dataInBlockSchemaFor } from '../block/in_block.js';
29
- import { L2BlockNew } from '../block/l2_block_new.js';
30
+ import { L2Block } from '../block/l2_block.js';
30
31
  import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
31
32
  import { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
32
33
  import {
@@ -77,13 +78,7 @@ import { type WorldStateSyncStatus, WorldStateSyncStatusSchema } from './world_s
77
78
  export interface AztecNode
78
79
  extends Pick<
79
80
  L2BlockSource,
80
- | 'getBlocks'
81
- | 'getL2BlocksNew'
82
- | 'getPublishedBlocks'
83
- | 'getPublishedCheckpoints'
84
- | 'getBlockHeader'
85
- | 'getL2Tips'
86
- | 'getCheckpointedBlocks'
81
+ 'getBlocks' | 'getCheckpoints' | 'getBlockHeader' | 'getL2Tips' | 'getCheckpointedBlocks'
87
82
  > {
88
83
  /**
89
84
  * Returns the tips of the L2 chain.
@@ -232,21 +227,21 @@ export interface AztecNode
232
227
  * @param number - The block number or 'latest'.
233
228
  * @returns The requested block.
234
229
  */
235
- getBlock(number: BlockParameter): Promise<L2BlockNew | undefined>;
230
+ getBlock(number: BlockParameter): Promise<L2Block | undefined>;
236
231
 
237
232
  /**
238
233
  * Get a block specified by its hash.
239
234
  * @param blockHash - The block hash being requested.
240
235
  * @returns The requested block.
241
236
  */
242
- getBlockByHash(blockHash: Fr): Promise<L2BlockNew | undefined>;
237
+ getBlockByHash(blockHash: Fr): Promise<L2Block | undefined>;
243
238
 
244
239
  /**
245
240
  * Get a block specified by its archive root.
246
241
  * @param archive - The archive root being requested.
247
242
  * @returns The requested block.
248
243
  */
249
- getBlockByArchive(archive: Fr): Promise<L2BlockNew | undefined>;
244
+ getBlockByArchive(archive: Fr): Promise<L2Block | undefined>;
250
245
 
251
246
  /**
252
247
  * Method to fetch the latest block number synchronized by the node.
@@ -260,6 +255,12 @@ export interface AztecNode
260
255
  */
261
256
  getProvenBlockNumber(): Promise<BlockNumber>;
262
257
 
258
+ /**
259
+ * Fetches the latest checkpointed block number.
260
+ * @returns The block number.
261
+ */
262
+ getCheckpointedBlockNumber(): Promise<BlockNumber>;
263
+
263
264
  /**
264
265
  * Method to determine if the node is ready to accept transactions.
265
266
  * @returns - Flag indicating the readiness for tx submission.
@@ -279,7 +280,7 @@ export interface AztecNode
279
280
  * @param limit - The maximum number of blocks to return.
280
281
  * @returns The blocks requested.
281
282
  */
282
- getBlocks(from: BlockNumber, limit: number): Promise<L2BlockNew[]>;
283
+ getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
283
284
 
284
285
  /**
285
286
  * Method to fetch the current min fees.
@@ -347,10 +348,14 @@ export interface AztecNode
347
348
  * array implies no logs match that tag.
348
349
  * @param tags - The tags to search for.
349
350
  * @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.
350
355
  * @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
351
356
  * for a tag, the caller should fetch the next page to check for more logs.
352
357
  */
353
- getPrivateLogsByTags(tags: SiloedTag[], page?: number): Promise<TxScopedL2Log[][]>;
358
+ getPrivateLogsByTags(tags: SiloedTag[], page?: number, referenceBlock?: L2BlockHash): Promise<TxScopedL2Log[][]>;
354
359
 
355
360
  /**
356
361
  * Gets public logs that match any of the `tags` from the specified contract. For each tag, an array of matching
@@ -358,6 +363,10 @@ export interface AztecNode
358
363
  * @param contractAddress - The contract address to search logs for.
359
364
  * @param tags - The tags to search for.
360
365
  * @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.
361
370
  * @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
362
371
  * for a tag, the caller should fetch the next page to check for more logs.
363
372
  */
@@ -365,6 +374,7 @@ export interface AztecNode
365
374
  contractAddress: AztecAddress,
366
375
  tags: Tag[],
367
376
  page?: number,
377
+ referenceBlock?: L2BlockHash,
368
378
  ): Promise<TxScopedL2Log[][]>;
369
379
 
370
380
  /**
@@ -567,16 +577,18 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
567
577
  .args(EpochNumberSchema)
568
578
  .returns(z.array(z.array(z.array(z.array(schemas.Fr))))),
569
579
 
570
- getBlock: z.function().args(BlockParameterSchema).returns(L2BlockNew.schema.optional()),
580
+ getBlock: z.function().args(BlockParameterSchema).returns(L2Block.schema.optional()),
571
581
 
572
- getBlockByHash: z.function().args(schemas.Fr).returns(L2BlockNew.schema.optional()),
582
+ getBlockByHash: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
573
583
 
574
- getBlockByArchive: z.function().args(schemas.Fr).returns(L2BlockNew.schema.optional()),
584
+ getBlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
575
585
 
576
586
  getBlockNumber: z.function().returns(BlockNumberSchema),
577
587
 
578
588
  getProvenBlockNumber: z.function().returns(BlockNumberSchema),
579
589
 
590
+ getCheckpointedBlockNumber: z.function().returns(BlockNumberSchema),
591
+
580
592
  isReady: z.function().returns(z.boolean()),
581
593
 
582
594
  getNodeInfo: z.function().returns(NodeInfoSchema),
@@ -584,26 +596,16 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
584
596
  getBlocks: z
585
597
  .function()
586
598
  .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
587
- .returns(z.array(L2BlockNew.schema)),
599
+ .returns(z.array(L2Block.schema)),
588
600
 
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
601
+ getCheckpoints: z
595
602
  .function()
596
603
  .args(CheckpointNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_CHECKPOINTS_LEN))
597
604
  .returns(z.array(PublishedCheckpoint.schema)),
598
605
 
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
606
  getCheckpointedBlocks: z
605
607
  .function()
606
- .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN), optional(z.boolean()))
608
+ .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
607
609
  .returns(z.array(CheckpointedL2Block.schema)),
608
610
 
609
611
  getCurrentMinFees: z.function().returns(GasFees.schema),
@@ -631,12 +633,17 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
631
633
 
632
634
  getPrivateLogsByTags: z
633
635
  .function()
634
- .args(z.array(SiloedTag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)))
636
+ .args(z.array(SiloedTag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)), optional(L2BlockHash.schema))
635
637
  .returns(z.array(z.array(TxScopedL2Log.schema))),
636
638
 
637
639
  getPublicLogsByTagsFromContract: z
638
640
  .function()
639
- .args(schemas.AztecAddress, z.array(Tag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)))
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
+ )
640
647
  .returns(z.array(z.array(TxScopedL2Log.schema))),
641
648
 
642
649
  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 { L2BlockNew } from '../block/l2_block_new.js';
4
+ import type { L2Block } from '../block/l2_block.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<L2BlockNew>;
34
+ setBlockCompleted(expectedBlockHeader?: BlockHeader): Promise<L2Block>;
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: L2BlockNew;
66
+ block: L2Block;
67
67
  publicGas: Gas;
68
68
  publicProcessorDuration: number;
69
69
  numTxs: number;
@@ -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
 
@@ -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
  }
@@ -55,8 +55,7 @@ export type ValidatorClientConfig = ValidatorHASignerConfig & {
55
55
  /** Skip checkpoint proposal validation and always attest (default: true) */
56
56
  skipCheckpointProposalValidation?: boolean;
57
57
 
58
- // TODO(palla/mbps): Change default to false once block sync is stable
59
- /** Skip pushing re-executed blocks to archiver (default: true) */
58
+ /** Skip pushing re-executed blocks to archiver (default: false) */
60
59
  skipPushProposedBlocksToArchiver?: boolean;
61
60
  };
62
61
 
@@ -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
  }
@@ -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';
@@ -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 L2BlockNew to compare against
287
+ * @param block - The L2Block to compare against
288
288
  * @returns True if the proposal matches the block
289
289
  */
290
- matchesBlock(block: L2BlockNew): boolean {
290
+ matchesBlock(block: L2Block): boolean {
291
291
  return this.archiveRoot.equals(block.archive.root) && this.blockHeader.equals(block.header);
292
292
  }
293
293
 
@@ -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
  }
@@ -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
@@ -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, L2BlockNew } from '../block/index.js';
25
+ import { CheckpointedL2Block, CommitteeAttestation, L2Block } 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,32 +404,37 @@ export async function mockCheckpointAndMessages(
404
404
  numL1ToL2Messages = 1,
405
405
  makeBlockOptions = () => ({}),
406
406
  previousArchive,
407
+ maxEffects,
407
408
  ...options
408
409
  }: {
409
410
  startBlockNumber?: BlockNumber;
410
411
  numBlocks?: number;
411
412
  numTxsPerBlock?: number;
412
413
  numL1ToL2Messages?: number;
413
- makeBlockOptions?: (blockNumber: BlockNumber) => Partial<Parameters<typeof L2BlockNew.random>[1]>;
414
+ makeBlockOptions?: (blockNumber: BlockNumber) => Partial<Parameters<typeof L2Block.random>[1]>;
414
415
  previousArchive?: AppendOnlyTreeSnapshot;
415
- blocks?: L2BlockNew[];
416
+ blocks?: L2Block[];
417
+ maxEffects?: number;
416
418
  } & Partial<Parameters<typeof Checkpoint.random>[1]> &
417
- Partial<Parameters<typeof L2BlockNew.random>[1]> = {},
419
+ Partial<Parameters<typeof L2Block.random>[1]> = {},
418
420
  ) {
419
- const slotNumber = options.slotNumber ?? SlotNumber(checkpointNumber * 10);
421
+ const slotNumber = options.slotNumber ?? SlotNumber(Number(checkpointNumber) * 10);
420
422
  const blocksAndMessages = [];
421
423
  // Track the previous block's archive to ensure consecutive blocks have consistent archive roots.
422
424
  // The current block's header.lastArchive must equal the previous block's archive.
423
425
  let lastArchive: AppendOnlyTreeSnapshot | undefined = previousArchive;
426
+ // Pass maxEffects via txOptions so it reaches TxEffect.random
427
+ const txOptions = maxEffects !== undefined ? { maxEffects } : {};
424
428
  for (let i = 0; i < (blocks?.length ?? numBlocks); i++) {
425
429
  const blockNumber = BlockNumber(startBlockNumber + i);
426
430
  const { block, messages } = {
427
431
  block:
428
432
  blocks?.[i] ??
429
- (await L2BlockNew.random(blockNumber, {
433
+ (await L2Block.random(blockNumber, {
430
434
  checkpointNumber,
431
435
  indexWithinCheckpoint: IndexWithinCheckpoint(i),
432
436
  txsPerBlock: numTxsPerBlock,
437
+ txOptions,
433
438
  slotNumber,
434
439
  ...options,
435
440
  ...makeBlockOptions(blockNumber),
@@ -670,15 +675,15 @@ export const makeCheckpointAttestationFromCheckpoint = (
670
675
  };
671
676
 
672
677
  /**
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.
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.
675
680
  */
676
681
  export const makeCheckpointAttestationFromBlock = (
677
- block: L2BlockNew,
682
+ block: L2Block,
678
683
  attesterSigner?: Secp256k1Signer,
679
684
  proposerSigner?: Secp256k1Signer,
680
685
  ): CheckpointAttestation => {
681
- // For L2BlockNew, we create a minimal checkpoint header for testing purposes
686
+ // For L2Block, we create a minimal checkpoint header for testing purposes
682
687
  const header = CheckpointHeader.empty({
683
688
  lastArchiveRoot: block.header.lastArchive.root,
684
689
  slotNumber: block.slot,
@@ -694,7 +699,7 @@ export async function randomPublishedL2Block(
694
699
  l2BlockNumber: number,
695
700
  opts: { signers?: Secp256k1Signer[] } = {},
696
701
  ): Promise<CheckpointedL2Block> {
697
- const block = await L2BlockNew.random(BlockNumber(l2BlockNumber));
702
+ const block = await L2Block.random(BlockNumber(l2BlockNumber));
698
703
  const l1 = L1PublishedData.fromFields({
699
704
  blockNumber: BigInt(block.number),
700
705
  timestamp: block.header.globalVariables.timestamp,
@@ -702,7 +707,9 @@ export async function randomPublishedL2Block(
702
707
  });
703
708
 
704
709
  const signers = opts.signers ?? times(3, () => Secp256k1Signer.random());
705
- const checkpoint = await Checkpoint.random(CheckpointNumber(l2BlockNumber), { numBlocks: 0 });
710
+ const checkpoint = await Checkpoint.random(CheckpointNumber.fromBlockNumber(BlockNumber(l2BlockNumber)), {
711
+ numBlocks: 0,
712
+ });
706
713
  checkpoint.blocks = [block];
707
714
  const atts = signers.map(signer =>
708
715
  makeCheckpointAttestation({
@@ -714,5 +721,5 @@ export async function randomPublishedL2Block(
714
721
  const attestations = atts.map(
715
722
  (attestation, i) => new CommitteeAttestation(signers[i].address, attestation.signature),
716
723
  );
717
- return new CheckpointedL2Block(CheckpointNumber(l2BlockNumber), block, l1, attestations);
724
+ return new CheckpointedL2Block(CheckpointNumber.fromBlockNumber(BlockNumber(l2BlockNumber)), block, l1, attestations);
718
725
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"l2_block_new.d.ts","sourceRoot":"","sources":["../../src/block/l2_block_new.ts"],"names":[],"mappings":"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"}