@aztec/stdlib 5.0.0-nightly.20260428 → 5.0.0-nightly.20260430

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 (120) hide show
  1. package/dest/avm/avm.d.ts +300 -300
  2. package/dest/block/attestation_info.d.ts +3 -2
  3. package/dest/block/attestation_info.d.ts.map +1 -1
  4. package/dest/block/attestation_info.js +7 -5
  5. package/dest/block/block_data.d.ts +290 -1
  6. package/dest/block/block_data.d.ts.map +1 -1
  7. package/dest/block/block_data.js +14 -0
  8. package/dest/block/block_parameter.d.ts +30 -3
  9. package/dest/block/block_parameter.d.ts.map +1 -1
  10. package/dest/block/block_parameter.js +36 -2
  11. package/dest/block/l2_block_source.d.ts +39 -4
  12. package/dest/block/l2_block_source.d.ts.map +1 -1
  13. package/dest/block/proposal/attestations_and_signers.d.ts +13 -6
  14. package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
  15. package/dest/block/proposal/attestations_and_signers.js +26 -18
  16. package/dest/checkpoint/checkpoint_data.d.ts +7 -1
  17. package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
  18. package/dest/checkpoint/checkpoint_data.js +2 -0
  19. package/dest/config/chain-config.d.ts +2 -2
  20. package/dest/config/chain-config.d.ts.map +1 -1
  21. package/dest/config/chain-config.js +2 -2
  22. package/dest/config/sequencer-config.d.ts +2 -2
  23. package/dest/config/sequencer-config.d.ts.map +1 -1
  24. package/dest/config/sequencer-config.js +6 -6
  25. package/dest/ha-signing/local_config.d.ts +1 -1
  26. package/dest/ha-signing/local_config.d.ts.map +1 -1
  27. package/dest/ha-signing/local_config.js +2 -2
  28. package/dest/interfaces/archiver.d.ts +1 -1
  29. package/dest/interfaces/archiver.d.ts.map +1 -1
  30. package/dest/interfaces/archiver.js +7 -3
  31. package/dest/interfaces/aztec-node-admin.d.ts +11 -1
  32. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  33. package/dest/interfaces/aztec-node-admin.js +2 -1
  34. package/dest/interfaces/aztec-node.d.ts +45 -55
  35. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  36. package/dest/interfaces/aztec-node.js +18 -16
  37. package/dest/interfaces/block_response.d.ts +156 -0
  38. package/dest/interfaces/block_response.d.ts.map +1 -0
  39. package/dest/interfaces/block_response.js +24 -0
  40. package/dest/interfaces/chain_tips.d.ts +304 -0
  41. package/dest/interfaces/chain_tips.d.ts.map +1 -0
  42. package/dest/interfaces/chain_tips.js +11 -0
  43. package/dest/interfaces/checkpoint_parameter.d.ts +27 -0
  44. package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -0
  45. package/dest/interfaces/checkpoint_parameter.js +20 -0
  46. package/dest/interfaces/checkpoint_response.d.ts +312 -0
  47. package/dest/interfaces/checkpoint_response.d.ts.map +1 -0
  48. package/dest/interfaces/checkpoint_response.js +26 -0
  49. package/dest/interfaces/client.d.ts +6 -1
  50. package/dest/interfaces/client.d.ts.map +1 -1
  51. package/dest/interfaces/client.js +5 -0
  52. package/dest/interfaces/configs.d.ts +7 -2
  53. package/dest/interfaces/configs.d.ts.map +1 -1
  54. package/dest/interfaces/configs.js +2 -1
  55. package/dest/interfaces/l1_publish_info.d.ts +43 -0
  56. package/dest/interfaces/l1_publish_info.d.ts.map +1 -0
  57. package/dest/interfaces/l1_publish_info.js +26 -0
  58. package/dest/interfaces/proving-job.d.ts +166 -166
  59. package/dest/interfaces/server.d.ts +6 -1
  60. package/dest/interfaces/server.d.ts.map +1 -1
  61. package/dest/interfaces/server.js +5 -0
  62. package/dest/interfaces/validator.d.ts +10 -1
  63. package/dest/interfaces/validator.d.ts.map +1 -1
  64. package/dest/interfaces/validator.js +1 -0
  65. package/dest/p2p/block_proposal.d.ts +19 -9
  66. package/dest/p2p/block_proposal.d.ts.map +1 -1
  67. package/dest/p2p/block_proposal.js +42 -32
  68. package/dest/p2p/checkpoint_attestation.d.ts +7 -3
  69. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  70. package/dest/p2p/checkpoint_attestation.js +15 -17
  71. package/dest/p2p/checkpoint_proposal.d.ts +15 -7
  72. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  73. package/dest/p2p/checkpoint_proposal.js +31 -29
  74. package/dest/p2p/consensus_payload.d.ts +18 -7
  75. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  76. package/dest/p2p/consensus_payload.js +31 -19
  77. package/dest/p2p/signature_utils.d.ts +28 -19
  78. package/dest/p2p/signature_utils.d.ts.map +1 -1
  79. package/dest/p2p/signature_utils.js +118 -21
  80. package/dest/p2p/signed_txs.d.ts +15 -13
  81. package/dest/p2p/signed_txs.d.ts.map +1 -1
  82. package/dest/p2p/signed_txs.js +26 -24
  83. package/dest/tests/mocks.d.ts +7 -1
  84. package/dest/tests/mocks.d.ts.map +1 -1
  85. package/dest/tests/mocks.js +28 -14
  86. package/dest/timetable/index.d.ts +1 -1
  87. package/dest/timetable/index.d.ts.map +1 -1
  88. package/dest/timetable/index.js +25 -11
  89. package/dest/tx/profiling.js +4 -4
  90. package/package.json +8 -8
  91. package/src/block/attestation_info.ts +11 -11
  92. package/src/block/block_data.ts +17 -0
  93. package/src/block/block_parameter.ts +35 -2
  94. package/src/block/l2_block_source.ts +43 -3
  95. package/src/block/proposal/attestations_and_signers.ts +32 -17
  96. package/src/checkpoint/checkpoint_data.ts +4 -0
  97. package/src/config/chain-config.ts +2 -3
  98. package/src/config/sequencer-config.ts +10 -6
  99. package/src/ha-signing/local_config.ts +2 -2
  100. package/src/interfaces/archiver.ts +13 -3
  101. package/src/interfaces/aztec-node-admin.ts +3 -1
  102. package/src/interfaces/aztec-node.ts +105 -95
  103. package/src/interfaces/block_response.ts +79 -0
  104. package/src/interfaces/chain_tips.ts +24 -0
  105. package/src/interfaces/checkpoint_parameter.ts +22 -0
  106. package/src/interfaces/checkpoint_response.ts +84 -0
  107. package/src/interfaces/client.ts +5 -0
  108. package/src/interfaces/configs.ts +5 -1
  109. package/src/interfaces/l1_publish_info.ts +40 -0
  110. package/src/interfaces/server.ts +5 -0
  111. package/src/interfaces/validator.ts +5 -0
  112. package/src/p2p/block_proposal.ts +84 -28
  113. package/src/p2p/checkpoint_attestation.ts +15 -20
  114. package/src/p2p/checkpoint_proposal.ts +69 -37
  115. package/src/p2p/consensus_payload.ts +50 -28
  116. package/src/p2p/signature_utils.ts +110 -25
  117. package/src/p2p/signed_txs.ts +46 -28
  118. package/src/tests/mocks.ts +46 -26
  119. package/src/timetable/index.ts +26 -11
  120. package/src/tx/profiling.ts +4 -4
@@ -1,13 +1,13 @@
1
1
  import { ARCHIVE_HEIGHT, L1_TO_L2_MSG_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
2
2
  import { type L1ContractAddresses, L1ContractAddressesSchema } from '@aztec/ethereum/l1-contract-addresses';
3
3
  import {
4
- BlockNumber,
4
+ type BlockNumber,
5
5
  BlockNumberPositiveSchema,
6
6
  BlockNumberSchema,
7
- CheckpointNumber,
7
+ type CheckpointNumber,
8
8
  CheckpointNumberPositiveSchema,
9
9
  CheckpointNumberSchema,
10
- EpochNumber,
10
+ type EpochNumber,
11
11
  EpochNumberSchema,
12
12
  type SlotNumber,
13
13
  } from '@aztec/foundation/branded-types';
@@ -23,10 +23,8 @@ import { BlockHash } from '../block/block_hash.js';
23
23
  import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
24
24
  import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
25
25
  import { type DataInBlock, dataInBlockSchemaFor } from '../block/in_block.js';
26
- import { L2Block } from '../block/l2_block.js';
27
- import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
28
- import { CheckpointDataSchema } from '../checkpoint/checkpoint_data.js';
29
- import { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
26
+ import { type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
27
+ import { type CheckpointData, CheckpointDataSchema } from '../checkpoint/checkpoint_data.js';
30
28
  import {
31
29
  type ContractClassPublic,
32
30
  ContractClassPublicSchema,
@@ -61,6 +59,20 @@ import type { SingleValidatorStats, ValidatorsStats } from '../validators/types.
61
59
  import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
62
60
  import { type AllowedElement, AllowedElementSchema } from './allowed_element.js';
63
61
  import { MAX_RPC_BLOCKS_LEN, MAX_RPC_CHECKPOINTS_LEN, MAX_RPC_LEN, MAX_RPC_TXS_LEN } from './api_limit.js';
62
+ import {
63
+ type BlockIncludeOptions,
64
+ BlockIncludeOptionsSchema,
65
+ type BlockResponse,
66
+ BlockResponseSchema,
67
+ } from './block_response.js';
68
+ import { type ChainTip, ChainTipSchema, type ChainTips, ChainTipsSchema } from './chain_tips.js';
69
+ import { type CheckpointParameter, CheckpointParameterSchema } from './checkpoint_parameter.js';
70
+ import {
71
+ type CheckpointIncludeOptions,
72
+ CheckpointIncludeOptionsSchema,
73
+ type CheckpointResponse,
74
+ CheckpointResponseSchema,
75
+ } from './checkpoint_response.js';
64
76
  import {
65
77
  type GetContractClassLogsResponse,
66
78
  GetContractClassLogsResponseSchema,
@@ -73,21 +85,7 @@ import { type WorldStateSyncStatus, WorldStateSyncStatusSchema } from './world_s
73
85
  * The aztec node.
74
86
  * We will probably implement the additional interfaces by means other than Aztec Node as it's currently a privacy leak
75
87
  */
76
- export interface AztecNode
77
- extends Pick<
78
- L2BlockSource,
79
- | 'getBlocks'
80
- | 'getCheckpoints'
81
- | 'getBlockHeader'
82
- | 'getL2Tips'
83
- | 'getCheckpointedBlocks'
84
- | 'getCheckpointsDataForEpoch'
85
- > {
86
- /**
87
- * Returns the tips of the L2 chain.
88
- */
89
- getL2Tips(): Promise<L2Tips>;
90
-
88
+ export interface AztecNode {
91
89
  /**
92
90
  * Returns the sync status of the node's world state
93
91
  */
@@ -202,49 +200,76 @@ export interface AztecNode
202
200
  getL2ToL1Messages(epoch: EpochNumber): Promise<Fr[][][][]>;
203
201
 
204
202
  /**
205
- * Get a block specified by its block number or 'latest'.
206
- * @param blockParameter - The block parameter (block number, block hash, or 'latest').
207
- * @returns The requested block.
203
+ * Returns the block number at a given chain tip, or the latest proposed block number when
204
+ * `tip` is omitted.
208
205
  */
209
- getBlock(blockParameter: BlockParameter): Promise<L2Block | undefined>;
206
+ getBlockNumber(tip?: ChainTip): Promise<BlockNumber>;
210
207
 
211
208
  /**
212
- * Get a block specified by its hash.
213
- * @param blockHash - The block hash being requested.
214
- * @returns The requested block.
209
+ * Returns the checkpoint number at a given chain tip, or the latest checkpoint number when
210
+ * `tip` is omitted.
211
+ *
212
+ * @remarks **Semantic foot-gun**: block-side `'proposed'` means "latest proposed block" (chain
213
+ * head), but checkpoint-side `'proposed'` means "latest confirmed checkpoint" — pre-L1-confirm
214
+ * checkpoints are not exposed over RPC. `'checkpointed'` on the checkpoint side is equivalent.
215
215
  */
216
- getBlockByHash(blockHash: BlockHash): Promise<L2Block | undefined>;
216
+ getCheckpointNumber(tip?: ChainTip): Promise<CheckpointNumber>;
217
217
 
218
- /**
219
- * Get a block specified by its archive root.
220
- * @param archive - The archive root being requested.
221
- * @returns The requested block.
222
- */
223
- getBlockByArchive(archive: Fr): Promise<L2Block | undefined>;
218
+ /** Returns the tips of the L2 chain. */
219
+ getChainTips(): Promise<ChainTips>;
220
+
221
+ // TODO(spl/new-rpc-api): the following methods are kept on the interface as a stop-gap because
222
+ // `L2BlockStream` (used by PXE's block synchronizer) and `computeL2ToL1MembershipWitness` (used
223
+ // by end-to-end tests) still consume the internal archiver shapes. Remove them when those
224
+ // consumers are rewired to the unified `BlockResponse` / `CheckpointResponse` API.
225
+ /** @deprecated Scheduled for removal; use `getChainTips` for public callers. */
226
+ getL2Tips(): Promise<L2Tips>;
227
+ /** @deprecated Scheduled for removal; use `getBlock(param).then(r => r?.header)`. */
228
+ getBlockHeader(number: BlockNumber | 'latest'): Promise<BlockHeader | undefined>;
229
+ /** @deprecated Scheduled for removal; use `getBlocks(from, limit, { includeL1PublishInfo: true, includeAttestations: true })`. */
230
+ getCheckpointedBlocks(from: BlockNumber, limit: number): Promise<CheckpointedL2Block[]>;
231
+ /** @deprecated Scheduled for removal; use `getCheckpoints(from, limit)` over an explicit checkpoint range. */
232
+ getCheckpointsDataForEpoch(epoch: EpochNumber): Promise<CheckpointData[]>;
224
233
 
225
234
  /**
226
- * Method to fetch the latest block number synchronized by the node.
227
- * @returns The block number.
235
+ * Unified block fetch. Returns the block identified by `param`, with optional fields controlled
236
+ * by `options`.
237
+ * @param param - A block number, block hash, archive root, chain-tip name, or object variant.
238
+ * @param options - Narrowing options: `includeTransactions`, `includeL1PublishInfo`, `includeAttestations`.
228
239
  */
229
- getBlockNumber(): Promise<BlockNumber>;
240
+ getBlock<Opts extends BlockIncludeOptions = {}>(
241
+ param: BlockParameter,
242
+ options?: Opts,
243
+ ): Promise<BlockResponse<Opts> | undefined>;
230
244
 
231
245
  /**
232
- * Fetches the latest proven block number.
233
- * @returns The block number.
246
+ * Returns up to `limit` blocks starting from `from`, projected to the {@link BlockResponse}
247
+ * shape determined by `options`.
234
248
  */
235
- getProvenBlockNumber(): Promise<BlockNumber>;
249
+ getBlocks<Opts extends BlockIncludeOptions = {}>(
250
+ from: BlockNumber,
251
+ limit: number,
252
+ options?: Opts,
253
+ ): Promise<BlockResponse<Opts>[]>;
236
254
 
237
255
  /**
238
- * Fetches the latest checkpointed block number.
239
- * @returns The block number.
256
+ * Unified checkpoint fetch. Returns the checkpoint identified by `param`, with optional fields
257
+ * controlled by `options`.
240
258
  */
241
- getCheckpointedBlockNumber(): Promise<BlockNumber>;
259
+ getCheckpoint<Opts extends CheckpointIncludeOptions = {}>(
260
+ param: CheckpointParameter,
261
+ options?: Opts,
262
+ ): Promise<CheckpointResponse<Opts> | undefined>;
242
263
 
243
264
  /**
244
- * Method to fetch the latest checkpoint number synchronized by the node.
245
- * @returns The checkpoint number.
265
+ * Returns up to `limit` checkpoints starting from `from`, projected to the
266
+ * {@link CheckpointResponse} shape determined by `options`.
246
267
  */
247
- getCheckpointNumber(): Promise<CheckpointNumber>;
268
+ getCheckpoints<Opts extends CheckpointIncludeOptions = {}>(
269
+ from: CheckpointNumber,
270
+ limit: number,
271
+ options?: Opts,
272
+ ): Promise<CheckpointResponse<Opts>[]>;
248
273
 
249
274
  /**
250
275
  * Method to determine if the node is ready to accept transactions.
@@ -259,14 +284,6 @@ export interface AztecNode
259
284
  */
260
285
  getNodeInfo(): Promise<NodeInfo>;
261
286
 
262
- /**
263
- * Method to request blocks. Will attempt to return all requested blocks but will return only those available.
264
- * @param from - The start of the range of blocks to return.
265
- * @param limit - The maximum number of blocks to return.
266
- * @returns The blocks requested.
267
- */
268
- getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
269
-
270
287
  /**
271
288
  * Method to fetch the current min fees.
272
289
  * @returns The current min fees.
@@ -434,20 +451,6 @@ export interface AztecNode
434
451
  */
435
452
  getPublicStorageAt(referenceBlock: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr>;
436
453
 
437
- /**
438
- * Returns the block header for a given block number, block hash, or 'latest'.
439
- * @param block - The block parameter (block number, block hash, or 'latest'). Defaults to 'latest'.
440
- * @returns The requested block header.
441
- */
442
- getBlockHeader(block?: BlockParameter): Promise<BlockHeader | undefined>;
443
-
444
- /**
445
- * Get a block header specified by its archive root.
446
- * @param archive - The archive root being requested.
447
- * @returns The requested block header.
448
- */
449
- getBlockHeaderByArchive(archive: Fr): Promise<BlockHeader | undefined>;
450
-
451
454
  /** Returns stats for validators if enabled. */
452
455
  getValidatorsStats(): Promise<ValidatorsStats>;
453
456
 
@@ -503,8 +506,6 @@ const MAX_SIGNATURES_PER_REGISTER_CALL = 100;
503
506
  const MAX_SIGNATURE_LEN = 10000;
504
507
 
505
508
  export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
506
- getL2Tips: z.function().args().returns(L2TipsSchema),
507
-
508
509
  getWorldStateSyncStatus: z.function().args().returns(WorldStateSyncStatusSchema),
509
510
 
510
511
  findLeavesIndexes: z
@@ -551,40 +552,53 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
551
552
  .args(EpochNumberSchema)
552
553
  .returns(z.array(z.array(z.array(z.array(schemas.Fr))))),
553
554
 
554
- getBlock: z.function().args(BlockParameterSchema).returns(L2Block.schema.optional()),
555
+ getBlockNumber: z.function().args(optional(ChainTipSchema)).returns(BlockNumberSchema),
555
556
 
556
- getBlockByHash: z.function().args(BlockHash.schema).returns(L2Block.schema.optional()),
557
+ getCheckpointNumber: z.function().args(optional(ChainTipSchema)).returns(CheckpointNumberSchema),
557
558
 
558
- getBlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
559
+ getChainTips: z.function().args().returns(ChainTipsSchema),
559
560
 
560
- getBlockNumber: z.function().returns(BlockNumberSchema),
561
-
562
- getCheckpointNumber: z.function().returns(CheckpointNumberSchema),
561
+ getL2Tips: z.function().args().returns(L2TipsSchema),
563
562
 
564
- getProvenBlockNumber: z.function().returns(BlockNumberSchema),
563
+ getBlockHeader: z
564
+ .function()
565
+ .args(z.union([BlockNumberSchema, z.literal('latest')]))
566
+ .returns(BlockHeader.schema.optional()),
565
567
 
566
- getCheckpointedBlockNumber: z.function().returns(BlockNumberSchema),
568
+ getCheckpointedBlocks: z
569
+ .function()
570
+ .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
571
+ .returns(z.array(CheckpointedL2Block.schema)),
567
572
 
568
- isReady: z.function().returns(z.boolean()),
573
+ getCheckpointsDataForEpoch: z.function().args(EpochNumberSchema).returns(z.array(CheckpointDataSchema)),
569
574
 
570
- getNodeInfo: z.function().returns(NodeInfoSchema),
575
+ getBlock: z
576
+ .function()
577
+ .args(BlockParameterSchema, optional(BlockIncludeOptionsSchema))
578
+ .returns(BlockResponseSchema.optional()),
571
579
 
572
580
  getBlocks: z
573
581
  .function()
574
- .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
575
- .returns(z.array(L2Block.schema)),
582
+ .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN), optional(BlockIncludeOptionsSchema))
583
+ .returns(z.array(BlockResponseSchema)),
576
584
 
577
- getCheckpoints: z
585
+ getCheckpoint: z
578
586
  .function()
579
- .args(CheckpointNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_CHECKPOINTS_LEN))
580
- .returns(z.array(PublishedCheckpoint.schema)),
587
+ .args(CheckpointParameterSchema, optional(CheckpointIncludeOptionsSchema))
588
+ .returns(CheckpointResponseSchema.optional()),
581
589
 
582
- getCheckpointedBlocks: z
590
+ getCheckpoints: z
583
591
  .function()
584
- .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
585
- .returns(z.array(CheckpointedL2Block.schema)),
592
+ .args(
593
+ CheckpointNumberPositiveSchema,
594
+ z.number().gt(0).lte(MAX_RPC_CHECKPOINTS_LEN),
595
+ optional(CheckpointIncludeOptionsSchema),
596
+ )
597
+ .returns(z.array(CheckpointResponseSchema)),
586
598
 
587
- getCheckpointsDataForEpoch: z.function().args(EpochNumberSchema).returns(z.array(CheckpointDataSchema)),
599
+ isReady: z.function().returns(z.boolean()),
600
+
601
+ getNodeInfo: z.function().returns(NodeInfoSchema),
588
602
 
589
603
  getCurrentMinFees: z.function().returns(GasFees.schema),
590
604
 
@@ -648,10 +662,6 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
648
662
 
649
663
  getPublicStorageAt: z.function().args(BlockParameterSchema, schemas.AztecAddress, schemas.Fr).returns(schemas.Fr),
650
664
 
651
- getBlockHeader: z.function().args(optional(BlockParameterSchema)).returns(BlockHeader.schema.optional()),
652
-
653
- getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
654
-
655
665
  getValidatorsStats: z.function().returns(ValidatorsStatsSchema),
656
666
 
657
667
  getValidatorStats: z
@@ -0,0 +1,79 @@
1
+ import {
2
+ BlockNumberSchema,
3
+ CheckpointNumberSchema,
4
+ IndexWithinCheckpointSchema,
5
+ } from '@aztec/foundation/branded-types';
6
+ import type { BlockNumber, CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
7
+ import type { IfFlag, Prettify } from '@aztec/foundation/types';
8
+
9
+ import { z } from 'zod';
10
+
11
+ import { BlockHash } from '../block/block_hash.js';
12
+ import { Body } from '../block/body.js';
13
+ import { CommitteeAttestation } from '../block/proposal/committee_attestation.js';
14
+ import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
15
+ import { BlockHeader } from '../tx/block_header.js';
16
+ import { type L1PublishInfo, L1PublishInfoSchema } from './l1_publish_info.js';
17
+
18
+ /** Options for narrowing the response of `getBlock` / `getBlocks`. */
19
+ export type BlockIncludeOptions = {
20
+ /** Include the block body (tx effects). Off by default. */
21
+ includeTransactions?: boolean;
22
+ /** Include L1 publish info (populated with `published: false` if not yet on L1). Off by default. */
23
+ includeL1PublishInfo?: boolean;
24
+ /** Include committee attestations. Empty array until the block's checkpoint is published. Off by default. */
25
+ includeAttestations?: boolean;
26
+ };
27
+
28
+ export const BlockIncludeOptionsSchema: z.ZodType<BlockIncludeOptions> = z.object({
29
+ includeTransactions: z.boolean().optional(),
30
+ includeL1PublishInfo: z.boolean().optional(),
31
+ includeAttestations: z.boolean().optional(),
32
+ });
33
+
34
+ /** Required metadata always present on a {@link BlockResponse}. */
35
+ export type BlockResponseBase = {
36
+ /** Block header. */
37
+ header: BlockHeader;
38
+ /** Archive tree snapshot after this block. */
39
+ archive: AppendOnlyTreeSnapshot;
40
+ /** Hash of the block header. */
41
+ hash: BlockHash;
42
+ /** Checkpoint number this block belongs to. */
43
+ checkpointNumber: CheckpointNumber;
44
+ /** Position of the block within its checkpoint. */
45
+ indexWithinCheckpoint: IndexWithinCheckpoint;
46
+ /** L2 block number. */
47
+ number: BlockNumber;
48
+ };
49
+
50
+ /**
51
+ * RPC-surface representation of an L2 block.
52
+ *
53
+ * Generic over the include-options so that flagged fields become required when the caller passes a
54
+ * literal `true`. The default type argument ({@link BlockIncludeOptions}) yields the widest shape
55
+ * (all include-fields optional) — this is what the JSON-RPC wire layer validates against.
56
+ *
57
+ * @example
58
+ * const b: BlockResponse<{ includeTransactions: true }> = await node.getBlock(1, { includeTransactions: true });
59
+ * b.body; // required, not optional
60
+ */
61
+ export type BlockResponse<Opts extends BlockIncludeOptions = BlockIncludeOptions> = Prettify<
62
+ BlockResponseBase &
63
+ IfFlag<BlockIncludeOptions, Opts, 'includeTransactions', { body: Body }> &
64
+ IfFlag<BlockIncludeOptions, Opts, 'includeL1PublishInfo', { l1: L1PublishInfo }> &
65
+ IfFlag<BlockIncludeOptions, Opts, 'includeAttestations', { attestations: CommitteeAttestation[] }>
66
+ >;
67
+
68
+ /** Zod schema for the widest {@link BlockResponse} shape (all include-gated fields optional). */
69
+ export const BlockResponseSchema = z.object({
70
+ header: BlockHeader.schema,
71
+ archive: AppendOnlyTreeSnapshot.schema,
72
+ hash: BlockHash.schema,
73
+ checkpointNumber: CheckpointNumberSchema,
74
+ indexWithinCheckpoint: IndexWithinCheckpointSchema,
75
+ number: BlockNumberSchema,
76
+ body: Body.schema.optional(),
77
+ l1: L1PublishInfoSchema.optional(),
78
+ attestations: z.array(CommitteeAttestation.schema).optional(),
79
+ });
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+
3
+ import { type L2BlockTag, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
4
+
5
+ /**
6
+ * Public chain-tip selectors usable in RPC requests.
7
+ * Omits internal-only tags (e.g. `proposedCheckpoint`) from {@link L2BlockTag}.
8
+ */
9
+ export type ChainTip = Exclude<L2BlockTag, 'proposedCheckpoint'>;
10
+
11
+ export const ChainTipSchema = z.union([
12
+ z.literal('proposed'),
13
+ z.literal('checkpointed'),
14
+ z.literal('proven'),
15
+ z.literal('finalized'),
16
+ ]) satisfies z.ZodType<ChainTip>;
17
+
18
+ /**
19
+ * Tips of the L2 chain.
20
+ * Omits the sequencer-internal `proposedCheckpoint` from the public RPC surface.
21
+ */
22
+ export type ChainTips = Omit<L2Tips, 'proposedCheckpoint'>;
23
+
24
+ export const ChainTipsSchema = L2TipsSchema.omit({ proposedCheckpoint: true });
@@ -0,0 +1,22 @@
1
+ import { CheckpointNumberSchema, SlotNumberSchema } from '@aztec/foundation/branded-types';
2
+
3
+ import { z } from 'zod';
4
+
5
+ import { ChainTipSchema } from './chain_tips.js';
6
+
7
+ /**
8
+ * Selector for a checkpoint in RPC calls.
9
+ *
10
+ * Accepts a numeric checkpoint number (or `{ number }`), a slot number (`{ slot }`), a chain-tip
11
+ * name (e.g. `'proven'`), or `'latest'` (alias for `'proposed'` — on the checkpoint side, this
12
+ * means the most recent confirmed checkpoint).
13
+ */
14
+ export const CheckpointParameterSchema = z.union([
15
+ CheckpointNumberSchema,
16
+ ChainTipSchema,
17
+ z.literal('latest'),
18
+ z.object({ number: CheckpointNumberSchema }),
19
+ z.object({ slot: SlotNumberSchema }),
20
+ ]);
21
+
22
+ export type CheckpointParameter = z.infer<typeof CheckpointParameterSchema>;
@@ -0,0 +1,84 @@
1
+ import { BlockNumberSchema, CheckpointNumberSchema } from '@aztec/foundation/branded-types';
2
+ import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
+ import { schemas } from '@aztec/foundation/schemas';
5
+ import type { IfFlag, Prettify } from '@aztec/foundation/types';
6
+
7
+ import { z } from 'zod';
8
+
9
+ import { CommitteeAttestation } from '../block/proposal/committee_attestation.js';
10
+ import { CheckpointHeader } from '../rollup/checkpoint_header.js';
11
+ import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
12
+ import { type BlockResponse, BlockResponseSchema } from './block_response.js';
13
+ import { type L1PublishInfo, L1PublishInfoSchema } from './l1_publish_info.js';
14
+
15
+ /** Options for narrowing the response of `getCheckpoint` / `getCheckpoints`. */
16
+ export type CheckpointIncludeOptions = {
17
+ /** Include the nested blocks. Off by default. */
18
+ includeBlocks?: boolean;
19
+ /** When `includeBlocks` is true, include each block's body (tx effects). Off by default. No-op if `includeBlocks` is false. */
20
+ includeTransactions?: boolean;
21
+ /** Include L1 publish info. Off by default. */
22
+ includeL1PublishInfo?: boolean;
23
+ /** Include committee attestations. Off by default. */
24
+ includeAttestations?: boolean;
25
+ };
26
+
27
+ export const CheckpointIncludeOptionsSchema: z.ZodType<CheckpointIncludeOptions> = z.object({
28
+ includeBlocks: z.boolean().optional(),
29
+ includeTransactions: z.boolean().optional(),
30
+ includeL1PublishInfo: z.boolean().optional(),
31
+ includeAttestations: z.boolean().optional(),
32
+ });
33
+
34
+ /** Required metadata always present on a {@link CheckpointResponse}. */
35
+ export type CheckpointResponseBase = {
36
+ /** Checkpoint number. */
37
+ number: CheckpointNumber;
38
+ /** Checkpoint header. */
39
+ header: CheckpointHeader;
40
+ /** Archive tree snapshot after this checkpoint. */
41
+ archive: AppendOnlyTreeSnapshot;
42
+ /** Hash of the checkpoint out messages. */
43
+ checkpointOutHash: Fr;
44
+ /** First block number in this checkpoint. */
45
+ startBlock: BlockNumber;
46
+ /** Number of blocks in this checkpoint. */
47
+ blockCount: number;
48
+ /** Fee asset price modifier in basis points applied during this checkpoint. */
49
+ feeAssetPriceModifier: bigint;
50
+ };
51
+
52
+ // Only forward `includeTransactions` to nested blocks — the other include-flags on the checkpoint
53
+ // options do not apply to the nested block responses (those carry no independent L1 / attestations).
54
+ type NestedBlockOpts<Opts> = Opts extends { includeTransactions: true } ? { includeTransactions: true } : {};
55
+
56
+ /**
57
+ * RPC-surface representation of an L2 checkpoint.
58
+ *
59
+ * Generic over the include-options so that flagged fields become required when the caller passes a
60
+ * literal `true`. Only `includeTransactions` is forwarded to nested blocks, so
61
+ * `includeL1PublishInfo` / `includeAttestations` on a checkpoint request do not imply the same on
62
+ * its nested blocks. The default type argument ({@link CheckpointIncludeOptions}) yields the
63
+ * widest shape — what the JSON-RPC wire layer validates against.
64
+ */
65
+ export type CheckpointResponse<Opts extends CheckpointIncludeOptions = CheckpointIncludeOptions> = Prettify<
66
+ CheckpointResponseBase &
67
+ IfFlag<CheckpointIncludeOptions, Opts, 'includeBlocks', { blocks: BlockResponse<NestedBlockOpts<Opts>>[] }> &
68
+ IfFlag<CheckpointIncludeOptions, Opts, 'includeL1PublishInfo', { l1: L1PublishInfo }> &
69
+ IfFlag<CheckpointIncludeOptions, Opts, 'includeAttestations', { attestations: CommitteeAttestation[] }>
70
+ >;
71
+
72
+ /** Zod schema for the widest {@link CheckpointResponse} shape (all include-gated fields optional). */
73
+ export const CheckpointResponseSchema = z.object({
74
+ number: CheckpointNumberSchema,
75
+ header: CheckpointHeader.schema,
76
+ archive: AppendOnlyTreeSnapshot.schema,
77
+ checkpointOutHash: schemas.Fr,
78
+ startBlock: BlockNumberSchema,
79
+ blockCount: z.number(),
80
+ feeAssetPriceModifier: schemas.BigInt,
81
+ blocks: z.array(BlockResponseSchema).optional(),
82
+ l1: L1PublishInfoSchema.optional(),
83
+ attestations: z.array(CommitteeAttestation.schema).optional(),
84
+ });
@@ -1,6 +1,11 @@
1
1
  export * from './aztec-node.js';
2
2
  export * from './aztec-node-admin.js';
3
3
  export * from './aztec-node-debug.js';
4
+ export * from './block_response.js';
5
+ export * from './chain_tips.js';
6
+ export * from './checkpoint_parameter.js';
7
+ export * from './checkpoint_response.js';
8
+ export * from './l1_publish_info.js';
4
9
  export * from './private_kernel_prover.js';
5
10
  export * from './get_logs_response.js';
6
11
  export * from './api_limit.js';
@@ -83,6 +83,8 @@ export interface SequencerConfig {
83
83
  minBlocksForCheckpoint?: number;
84
84
  /** Skip publishing checkpoint proposals probability (for testing checkpoint prunes only) */
85
85
  skipPublishingCheckpointsPercent?: number;
86
+ /** Skip broadcasting checkpoint and block proposals via gossipsub when proposer (for testing only) */
87
+ skipBroadcastProposals?: boolean;
86
88
  }
87
89
 
88
90
  export const SequencerConfigSchema = zodFor<SequencerConfig>()(
@@ -124,6 +126,7 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
124
126
  skipPushProposedBlocksToArchiver: z.boolean().optional(),
125
127
  minBlocksForCheckpoint: z.number().positive().optional(),
126
128
  skipPublishingCheckpointsPercent: z.number().gte(0).lte(100).optional(),
129
+ skipBroadcastProposals: z.boolean().optional(),
127
130
  }),
128
131
  );
129
132
 
@@ -145,7 +148,8 @@ type SequencerConfigOptionalKeys =
145
148
  | 'maxTxsPerCheckpoint'
146
149
  | 'maxL2BlockGas'
147
150
  | 'maxDABlockGas'
148
- | 'redistributeCheckpointBudget';
151
+ | 'redistributeCheckpointBudget'
152
+ | 'skipBroadcastProposals';
149
153
 
150
154
  export type ResolvedSequencerConfig = Prettify<
151
155
  Required<Omit<SequencerConfig, SequencerConfigOptionalKeys>> & Pick<SequencerConfig, SequencerConfigOptionalKeys>
@@ -0,0 +1,40 @@
1
+ import { schemas } from '@aztec/foundation/schemas';
2
+
3
+ import { z } from 'zod';
4
+
5
+ import { L1PublishedData } from '../checkpoint/published_checkpoint.js';
6
+
7
+ /**
8
+ * L1 publication info for a block or checkpoint.
9
+ *
10
+ * A discriminated union over `published`: when `false`, the block/checkpoint has not yet been
11
+ * published to L1. When `true`, the L1 block info (number, timestamp, hash) is present.
12
+ *
13
+ * Distinct from {@link L1PublishedData}, which is always the "published" case.
14
+ */
15
+ export type L1PublishInfo =
16
+ | { published: false }
17
+ | { published: true; blockNumber: bigint; timestamp: bigint; blockHash: string };
18
+
19
+ export const L1PublishInfoSchema = z.union([
20
+ z.object({ published: z.literal(false) }),
21
+ z.object({
22
+ published: z.literal(true),
23
+ blockNumber: schemas.BigInt,
24
+ timestamp: schemas.BigInt,
25
+ blockHash: z.string(),
26
+ }),
27
+ ]);
28
+
29
+ /** Projects the internal {@link L1PublishedData} (or its absence) to the public {@link L1PublishInfo} shape. */
30
+ export function l1PublishInfoFromL1PublishedData(data: L1PublishedData | undefined): L1PublishInfo {
31
+ if (!data) {
32
+ return { published: false };
33
+ }
34
+ return {
35
+ published: true,
36
+ blockNumber: data.blockNumber,
37
+ timestamp: data.timestamp,
38
+ blockHash: data.blockHash,
39
+ };
40
+ }
@@ -2,6 +2,11 @@ export * from './allowed_element.js';
2
2
  export * from './api_limit.js';
3
3
  export * from './archiver.js';
4
4
  export * from './aztec-node.js';
5
+ export * from './block_response.js';
6
+ export * from './chain_tips.js';
7
+ export * from './checkpoint_parameter.js';
8
+ export * from './checkpoint_response.js';
9
+ export * from './l1_publish_info.js';
5
10
  export * from './block-builder.js';
6
11
  export * from './configs.js';
7
12
  export * from './epoch-prover.js';
@@ -19,6 +19,7 @@ import type { PeerId } from '@libp2p/interface';
19
19
  import { z } from 'zod';
20
20
 
21
21
  import type { CommitteeAttestationsAndSigners } from '../block/index.js';
22
+ import type { ChainConfig } from '../config/chain-config.js';
22
23
  import {
23
24
  type LocalSignerConfig,
24
25
  LocalSignerConfigSchema,
@@ -32,6 +33,9 @@ import { AllowedElementSchema } from './allowed_element.js';
32
33
  */
33
34
  export type ValidatorClientConfig = ValidatorHASignerConfig &
34
35
  LocalSignerConfig & {
36
+ /** The L1 chain id used for EIP-712 proposal-path signing. */
37
+ l1ChainId: ChainConfig['l1ChainId'];
38
+
35
39
  /** The private keys of the validators participating in attestation duties */
36
40
  validatorPrivateKeys?: SecretValue<`0x${string}`[]>;
37
41
 
@@ -90,6 +94,7 @@ export type ValidatorClientFullConfig = ValidatorClientConfig &
90
94
 
91
95
  export const ValidatorClientConfigSchema = zodFor<Omit<ValidatorClientConfig, 'validatorPrivateKeys'>>()(
92
96
  ValidatorHASignerConfigSchema.merge(LocalSignerConfigSchema).extend({
97
+ l1ChainId: z.number().int().nonnegative(),
93
98
  validatorAddresses: z.array(schemas.EthAddress).optional(),
94
99
  disableValidator: z.boolean(),
95
100
  disabledValidators: z.array(schemas.EthAddress),