@aztec/stdlib 0.0.1-commit.f295ac2 → 0.0.1-commit.fc805bf

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 (199) hide show
  1. package/dest/block/block_hash.d.ts +16 -18
  2. package/dest/block/block_hash.d.ts.map +1 -1
  3. package/dest/block/block_hash.js +21 -31
  4. package/dest/block/block_parameter.d.ts +4 -4
  5. package/dest/block/block_parameter.d.ts.map +1 -1
  6. package/dest/block/block_parameter.js +2 -2
  7. package/dest/block/checkpointed_l2_block.d.ts +6 -6
  8. package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
  9. package/dest/block/checkpointed_l2_block.js +3 -3
  10. package/dest/block/in_block.d.ts +11 -11
  11. package/dest/block/in_block.d.ts.map +1 -1
  12. package/dest/block/in_block.js +4 -4
  13. package/dest/block/index.d.ts +2 -2
  14. package/dest/block/index.d.ts.map +1 -1
  15. package/dest/block/index.js +1 -1
  16. package/dest/block/{l2_block_new.d.ts → l2_block.d.ts} +8 -7
  17. package/dest/block/l2_block.d.ts.map +1 -0
  18. package/dest/block/{l2_block_new.js → l2_block.js} +5 -9
  19. package/dest/block/l2_block_source.d.ts +39 -30
  20. package/dest/block/l2_block_source.d.ts.map +1 -1
  21. package/dest/block/l2_block_stream/interfaces.d.ts +3 -3
  22. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  23. package/dest/block/l2_block_stream/l2_block_stream.d.ts +6 -3
  24. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  25. package/dest/block/l2_block_stream/l2_block_stream.js +37 -25
  26. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +3 -3
  27. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  28. package/dest/block/test/l2_tips_store_test_suite.js +2 -2
  29. package/dest/checkpoint/checkpoint.d.ts +8 -8
  30. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  31. package/dest/checkpoint/checkpoint.js +4 -4
  32. package/dest/checkpoint/published_checkpoint.d.ts +2 -2
  33. package/dest/config/node-rpc-config.js +1 -1
  34. package/dest/contract/contract_address.js +1 -1
  35. package/dest/contract/contract_class_id.d.ts +1 -1
  36. package/dest/contract/contract_class_id.js +1 -1
  37. package/dest/contract/private_function.d.ts +1 -1
  38. package/dest/contract/private_function.d.ts.map +1 -1
  39. package/dest/contract/private_function.js +2 -3
  40. package/dest/contract/private_function_membership_proof.d.ts +1 -1
  41. package/dest/contract/private_function_membership_proof.js +1 -1
  42. package/dest/database-version/database_version.d.ts +58 -0
  43. package/dest/database-version/database_version.d.ts.map +1 -0
  44. package/dest/database-version/database_version.js +69 -0
  45. package/dest/database-version/version_manager.d.ts +2 -50
  46. package/dest/database-version/version_manager.d.ts.map +1 -1
  47. package/dest/database-version/version_manager.js +1 -66
  48. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
  49. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
  50. package/dest/delayed_public_mutable/delayed_public_mutable_values.js +7 -10
  51. package/dest/epoch-helpers/index.d.ts +3 -1
  52. package/dest/epoch-helpers/index.d.ts.map +1 -1
  53. package/dest/epoch-helpers/index.js +5 -1
  54. package/dest/hash/hash.js +2 -2
  55. package/dest/hash/map_slot.d.ts +1 -1
  56. package/dest/hash/map_slot.d.ts.map +1 -1
  57. package/dest/hash/map_slot.js +4 -3
  58. package/dest/interfaces/api_limit.d.ts +2 -1
  59. package/dest/interfaces/api_limit.d.ts.map +1 -1
  60. package/dest/interfaces/api_limit.js +1 -0
  61. package/dest/interfaces/archiver.d.ts +1 -1
  62. package/dest/interfaces/archiver.d.ts.map +1 -1
  63. package/dest/interfaces/archiver.js +19 -18
  64. package/dest/interfaces/aztec-node-admin.d.ts +4 -1
  65. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  66. package/dest/interfaces/aztec-node.d.ts +64 -62
  67. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  68. package/dest/interfaces/aztec-node.js +13 -17
  69. package/dest/interfaces/block-builder.d.ts +13 -7
  70. package/dest/interfaces/block-builder.d.ts.map +1 -1
  71. package/dest/interfaces/block-builder.js +7 -0
  72. package/dest/interfaces/configs.d.ts +2 -2
  73. package/dest/interfaces/configs.d.ts.map +1 -1
  74. package/dest/interfaces/get_logs_response.d.ts +7 -7
  75. package/dest/interfaces/l2_logs_source.d.ts +14 -5
  76. package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
  77. package/dest/interfaces/prover-client.d.ts +10 -1
  78. package/dest/interfaces/prover-client.d.ts.map +1 -1
  79. package/dest/interfaces/prover-client.js +7 -1
  80. package/dest/interfaces/tx_provider.d.ts +3 -3
  81. package/dest/interfaces/tx_provider.d.ts.map +1 -1
  82. package/dest/interfaces/validator.d.ts +3 -3
  83. package/dest/interfaces/validator.d.ts.map +1 -1
  84. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
  85. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
  86. package/dest/kernel/hints/build_nullifier_read_request_hints.js +4 -6
  87. package/dest/keys/derivation.d.ts +3 -3
  88. package/dest/keys/derivation.js +8 -8
  89. package/dest/keys/key_types.d.ts +1 -1
  90. package/dest/keys/utils.d.ts +1 -1
  91. package/dest/keys/utils.d.ts.map +1 -1
  92. package/dest/keys/utils.js +7 -3
  93. package/dest/l1-contracts/slash_factory.d.ts +1 -1
  94. package/dest/l1-contracts/slash_factory.d.ts.map +1 -1
  95. package/dest/l1-contracts/slash_factory.js +1 -0
  96. package/dest/logs/extended_public_log.d.ts +6 -6
  97. package/dest/logs/log_id.d.ts +8 -8
  98. package/dest/logs/log_id.d.ts.map +1 -1
  99. package/dest/logs/log_id.js +6 -5
  100. package/dest/logs/siloed_tag.d.ts +1 -1
  101. package/dest/logs/siloed_tag.d.ts.map +1 -1
  102. package/dest/logs/siloed_tag.js +4 -3
  103. package/dest/p2p/block_proposal.d.ts +13 -6
  104. package/dest/p2p/block_proposal.d.ts.map +1 -1
  105. package/dest/p2p/block_proposal.js +1 -1
  106. package/dest/p2p/checkpoint_proposal.d.ts +10 -3
  107. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  108. package/dest/p2p/constants.d.ts +3 -0
  109. package/dest/p2p/constants.d.ts.map +1 -0
  110. package/dest/p2p/constants.js +2 -0
  111. package/dest/p2p/index.d.ts +2 -1
  112. package/dest/p2p/index.d.ts.map +1 -1
  113. package/dest/p2p/index.js +1 -0
  114. package/dest/p2p/message_validator.d.ts +18 -3
  115. package/dest/p2p/message_validator.d.ts.map +1 -1
  116. package/dest/p2p/message_validator.js +2 -1
  117. package/dest/stats/stats.d.ts +1 -3
  118. package/dest/stats/stats.d.ts.map +1 -1
  119. package/dest/tests/factories.js +1 -1
  120. package/dest/tests/jest.d.ts +4 -4
  121. package/dest/tests/jest.js +9 -9
  122. package/dest/tests/mocks.d.ts +15 -10
  123. package/dest/tests/mocks.d.ts.map +1 -1
  124. package/dest/tests/mocks.js +19 -13
  125. package/dest/tx/block_header.d.ts +3 -2
  126. package/dest/tx/block_header.d.ts.map +1 -1
  127. package/dest/tx/block_header.js +3 -2
  128. package/dest/tx/in_tx.d.ts +3 -3
  129. package/dest/tx/indexed_tx_effect.d.ts +5 -5
  130. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  131. package/dest/tx/indexed_tx_effect.js +3 -2
  132. package/dest/tx/tx.d.ts +2 -1
  133. package/dest/tx/tx.d.ts.map +1 -1
  134. package/dest/tx/tx.js +6 -3
  135. package/dest/tx/tx_receipt.d.ts +42 -14
  136. package/dest/tx/tx_receipt.d.ts.map +1 -1
  137. package/dest/tx/tx_receipt.js +46 -15
  138. package/dest/tx/validator/error_texts.d.ts +2 -1
  139. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  140. package/dest/tx/validator/error_texts.js +2 -0
  141. package/package.json +11 -10
  142. package/src/block/block_hash.ts +26 -47
  143. package/src/block/block_parameter.ts +3 -3
  144. package/src/block/checkpointed_l2_block.ts +4 -4
  145. package/src/block/in_block.ts +7 -7
  146. package/src/block/index.ts +1 -1
  147. package/src/block/{l2_block_new.ts → l2_block.ts} +8 -12
  148. package/src/block/l2_block_source.ts +40 -31
  149. package/src/block/l2_block_stream/interfaces.ts +2 -2
  150. package/src/block/l2_block_stream/l2_block_stream.ts +44 -27
  151. package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
  152. package/src/block/test/l2_tips_store_test_suite.ts +4 -4
  153. package/src/checkpoint/checkpoint.ts +7 -7
  154. package/src/config/node-rpc-config.ts +1 -1
  155. package/src/contract/contract_address.ts +1 -1
  156. package/src/contract/contract_class_id.ts +1 -1
  157. package/src/contract/private_function.ts +2 -3
  158. package/src/contract/private_function_membership_proof.ts +1 -1
  159. package/src/database-version/database_version.ts +87 -0
  160. package/src/database-version/version_manager.ts +1 -77
  161. package/src/delayed_public_mutable/delayed_public_mutable_values.ts +9 -10
  162. package/src/epoch-helpers/index.ts +10 -1
  163. package/src/hash/hash.ts +2 -2
  164. package/src/hash/map_slot.ts +3 -2
  165. package/src/interfaces/api_limit.ts +1 -0
  166. package/src/interfaces/archiver.ts +19 -27
  167. package/src/interfaces/aztec-node.ts +89 -120
  168. package/src/interfaces/block-builder.ts +15 -5
  169. package/src/interfaces/configs.ts +1 -3
  170. package/src/interfaces/l2_logs_source.ts +17 -4
  171. package/src/interfaces/prover-client.ts +15 -0
  172. package/src/interfaces/tx_provider.ts +2 -2
  173. package/src/interfaces/validator.ts +2 -4
  174. package/src/kernel/hints/build_nullifier_read_request_hints.ts +1 -10
  175. package/src/keys/derivation.ts +8 -8
  176. package/src/keys/key_types.ts +1 -1
  177. package/src/keys/utils.ts +7 -3
  178. package/src/l1-contracts/slash_factory.ts +1 -0
  179. package/src/logs/log_id.ts +7 -6
  180. package/src/logs/siloed_tag.ts +3 -2
  181. package/src/p2p/block_proposal.ts +12 -5
  182. package/src/p2p/checkpoint_proposal.ts +9 -2
  183. package/src/p2p/constants.ts +3 -0
  184. package/src/p2p/index.ts +1 -0
  185. package/src/p2p/message_validator.ts +14 -2
  186. package/src/stats/stats.ts +0 -2
  187. package/src/tests/factories.ts +1 -1
  188. package/src/tests/jest.ts +9 -9
  189. package/src/tests/mocks.ts +26 -17
  190. package/src/tx/block_header.ts +7 -4
  191. package/src/tx/indexed_tx_effect.ts +3 -2
  192. package/src/tx/tx.ts +8 -9
  193. package/src/tx/tx_receipt.ts +75 -18
  194. package/src/tx/validator/error_texts.ts +3 -0
  195. package/dest/block/l2_block_new.d.ts.map +0 -1
  196. package/dest/database-version/index.d.ts +0 -2
  197. package/dest/database-version/index.d.ts.map +0 -1
  198. package/dest/database-version/index.js +0 -1
  199. package/src/database-version/index.ts +0 -1
@@ -7,6 +7,9 @@ import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.
7
7
  import { type L2BlockId, type L2BlockSource, makeL2BlockId } from '../l2_block_source.js';
8
8
  import type { L2BlockStreamEvent, L2BlockStreamEventHandler, L2BlockStreamLocalDataProvider } from './interfaces.js';
9
9
 
10
+ /** Maximum number of checkpoints to prefetch at once during sync. Matches MAX_RPC_CHECKPOINTS_LEN. */
11
+ export const CHECKPOINT_PREFETCH_LIMIT = 50;
12
+
10
13
  /** Creates a stream of events for new blocks, chain tips updates, and reorgs, out of polling an archiver or a node. */
11
14
  export class L2BlockStream {
12
15
  private readonly runningPromise: RunningPromise;
@@ -16,13 +19,12 @@ export class L2BlockStream {
16
19
  constructor(
17
20
  private l2BlockSource: Pick<
18
21
  L2BlockSource,
19
- 'getL2BlocksNew' | 'getBlockHeader' | 'getL2Tips' | 'getPublishedCheckpoints' | 'getCheckpointedBlocks'
22
+ 'getBlocks' | 'getBlockHeader' | 'getL2Tips' | 'getCheckpoints' | 'getCheckpointedBlocks'
20
23
  >,
21
24
  private localData: L2BlockStreamLocalDataProvider,
22
25
  private handler: L2BlockStreamEventHandler,
23
26
  private readonly log = createLogger('types:block_stream'),
24
27
  private opts: {
25
- proven?: boolean;
26
28
  pollIntervalMS?: number;
27
29
  batchSize?: number;
28
30
  startingBlock?: number;
@@ -30,6 +32,8 @@ export class L2BlockStream {
30
32
  skipFinalized?: boolean;
31
33
  /** When true, checkpoint events will not be emitted. Blocks are still fetched via checkpoints but only blocks-added events are emitted. */
32
34
  ignoreCheckpoints?: boolean;
35
+ /** Maximum number of checkpoints to prefetch at once during sync. Defaults to CHECKPOINT_PREFETCH_LIMIT (50). */
36
+ checkpointPrefetchLimit?: number;
33
37
  } = {},
34
38
  ) {
35
39
  // Note that RunningPromise is in stopped state by default. This promise won't run until someone invokes `start`,
@@ -124,7 +128,7 @@ export class L2BlockStream {
124
128
  if (!this.opts.ignoreCheckpoints) {
125
129
  let loop1Iterations = 0;
126
130
  while (nextCheckpointToEmit <= sourceTips.checkpointed.checkpoint.number) {
127
- const checkpoints = await this.l2BlockSource.getPublishedCheckpoints(nextCheckpointToEmit, 1);
131
+ const checkpoints = await this.l2BlockSource.getCheckpoints(nextCheckpointToEmit, 1);
128
132
  if (checkpoints.length === 0) {
129
133
  break;
130
134
  }
@@ -150,27 +154,36 @@ export class L2BlockStream {
150
154
  }
151
155
  }
152
156
 
153
- // Loop 2: Fetch new checkpointed blocks. For each block, get its checkpoint, emit all blocks
157
+ // Loop 2: Fetch new checkpointed blocks. For each checkpoint, emit all blocks
154
158
  // from that checkpoint that we need, then emit the checkpoint event.
155
- // We cache the current checkpoint to avoid redundant fetches when batchSize < checkpoint size.
156
- let checkpoint: PublishedCheckpoint | undefined;
157
- while (nextBlockNumber <= sourceTips.checkpointed.block.number) {
158
- const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.checkpointed.block.number - nextBlockNumber + 1);
159
+ // We prefetch multiple checkpoints, then process them one by one.
160
+ let prefetchedCheckpoints: PublishedCheckpoint[] = [];
161
+ let prefetchIdx = 0;
162
+ let nextCheckpointNumber: CheckpointNumber | undefined;
159
163
 
160
- // Check if we need to fetch a new checkpoint (nextBlockNumber is beyond the cached one)
161
- if (!checkpoint || nextBlockNumber > checkpoint.checkpoint.blocks.at(-1)!.number) {
162
- const blocks = await this.l2BlockSource.getCheckpointedBlocks(BlockNumber(nextBlockNumber), 1);
163
- if (blocks.length === 0) {
164
- break;
165
- }
166
- const checkpoints = await this.l2BlockSource.getPublishedCheckpoints(blocks[0].checkpointNumber, 1);
167
- if (checkpoints.length === 0) {
164
+ // Find the starting checkpoint number
165
+ if (nextBlockNumber <= sourceTips.checkpointed.block.number) {
166
+ const blocks = await this.l2BlockSource.getCheckpointedBlocks(BlockNumber(nextBlockNumber), 1);
167
+ if (blocks.length > 0) {
168
+ nextCheckpointNumber = blocks[0].checkpointNumber;
169
+ }
170
+ }
171
+
172
+ while (nextBlockNumber <= sourceTips.checkpointed.block.number && nextCheckpointNumber !== undefined) {
173
+ // Refill the prefetch buffer when exhausted
174
+ if (prefetchIdx >= prefetchedCheckpoints.length) {
175
+ const prefetchLimit = this.opts.checkpointPrefetchLimit ?? CHECKPOINT_PREFETCH_LIMIT;
176
+ prefetchedCheckpoints = await this.l2BlockSource.getCheckpoints(nextCheckpointNumber, prefetchLimit);
177
+ prefetchIdx = 0;
178
+ if (prefetchedCheckpoints.length === 0) {
168
179
  break;
169
180
  }
170
- checkpoint = checkpoints[0];
171
181
  }
172
182
 
183
+ const checkpoint = prefetchedCheckpoints[prefetchIdx]!;
184
+
173
185
  // Get all blocks from this checkpoint that we need, respecting batchSize
186
+ const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.checkpointed.block.number - nextBlockNumber + 1);
174
187
  const blocksForCheckpoint = checkpoint.checkpoint.blocks
175
188
  .filter(b => b.number >= nextBlockNumber)
176
189
  .slice(0, limit);
@@ -180,23 +193,27 @@ export class L2BlockStream {
180
193
  await this.emitEvent({ type: 'blocks-added', blocks: blocksForCheckpoint });
181
194
  nextBlockNumber = blocksForCheckpoint.at(-1)!.number + 1;
182
195
 
183
- // If we've reached the end of this checkpoint, emit the checkpoint event
196
+ // If we've reached the end of this checkpoint, emit the checkpoint event and move to next
184
197
  const lastBlockInCheckpoint = checkpoint.checkpoint.blocks.at(-1)!;
185
- if (!this.opts.ignoreCheckpoints && nextBlockNumber > lastBlockInCheckpoint.number) {
186
- const lastBlockHash = await lastBlockInCheckpoint.hash();
187
- await this.emitEvent({
188
- type: 'chain-checkpointed',
189
- checkpoint,
190
- block: makeL2BlockId(lastBlockInCheckpoint.number, lastBlockHash.toString()),
191
- });
198
+ if (nextBlockNumber > lastBlockInCheckpoint.number) {
199
+ if (!this.opts.ignoreCheckpoints) {
200
+ const lastBlockHash = await lastBlockInCheckpoint.hash();
201
+ await this.emitEvent({
202
+ type: 'chain-checkpointed',
203
+ checkpoint,
204
+ block: makeL2BlockId(lastBlockInCheckpoint.number, lastBlockHash.toString()),
205
+ });
206
+ }
207
+ prefetchIdx++;
208
+ nextCheckpointNumber = CheckpointNumber(nextCheckpointNumber + 1);
192
209
  }
193
210
  }
194
211
 
195
212
  // Loop 3: Fetch any remaining uncheckpointed (proposed) blocks.
196
213
  while (nextBlockNumber <= sourceTips.proposed.number) {
197
214
  const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.proposed.number - nextBlockNumber + 1);
198
- this.log.trace(`Requesting blocks from ${nextBlockNumber} limit ${limit} proven=${this.opts.proven}`);
199
- const blocks = await this.l2BlockSource.getL2BlocksNew(BlockNumber(nextBlockNumber), limit, this.opts.proven);
215
+ this.log.trace(`Requesting blocks from ${nextBlockNumber} limit ${limit}`);
216
+ const blocks = await this.l2BlockSource.getBlocks(BlockNumber(nextBlockNumber), BlockNumber(limit));
200
217
  if (blocks.length === 0) {
201
218
  break;
202
219
  }
@@ -2,7 +2,7 @@ import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
2
2
  import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3
3
 
4
4
  import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
5
- import type { L2BlockNew } from '../l2_block_new.js';
5
+ import type { L2Block } from '../l2_block.js';
6
6
  import {
7
7
  type CheckpointId,
8
8
  GENESIS_CHECKPOINT_HEADER_HASH,
@@ -109,7 +109,7 @@ export abstract class L2TipsStoreBase implements L2BlockStreamEventHandler, L2Bl
109
109
  }
110
110
 
111
111
  // Protected helper that subclasses can override for block hash computation
112
- protected computeBlockHash(block: L2BlockNew): Promise<string> {
112
+ protected computeBlockHash(block: L2Block): Promise<string> {
113
113
  return block.hash().then(hash => hash.toString());
114
114
  }
115
115
 
@@ -5,8 +5,8 @@ import { Fr } from '@aztec/foundation/curves/bn254';
5
5
  import {
6
6
  type CheckpointId,
7
7
  GENESIS_CHECKPOINT_HEADER_HASH,
8
+ L2Block,
8
9
  type L2BlockId,
9
- L2BlockNew,
10
10
  type L2TipId,
11
11
  } from '@aztec/stdlib/block';
12
12
  import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
@@ -31,8 +31,8 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
31
31
  blockToCheckpoint.clear();
32
32
  });
33
33
 
34
- const makeBlock = async (number: number): Promise<L2BlockNew> => {
35
- const block = await L2BlockNew.random(BlockNumber(number));
34
+ const makeBlock = async (number: number): Promise<L2Block> => {
35
+ const block = await L2Block.random(BlockNumber(number));
36
36
  blockHashes.set(number, (await block.hash()).toString());
37
37
  return block;
38
38
  };
@@ -74,7 +74,7 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
74
74
  checkpointed: makeTipId(checkpointed),
75
75
  });
76
76
 
77
- const makeCheckpoint = async (checkpointNumber: number, blocks: L2BlockNew[]): Promise<PublishedCheckpoint> => {
77
+ const makeCheckpoint = async (checkpointNumber: number, blocks: L2Block[]): Promise<PublishedCheckpoint> => {
78
78
  const checkpoint = await Checkpoint.random(CheckpointNumber(checkpointNumber), {
79
79
  numBlocks: blocks.length,
80
80
  startBlockNumber: blocks[0].number,
@@ -13,7 +13,7 @@ import type { FieldsOf } from '@aztec/foundation/types';
13
13
 
14
14
  import { z } from 'zod';
15
15
 
16
- import { L2BlockNew } from '../block/l2_block_new.js';
16
+ import { L2Block } from '../block/l2_block.js';
17
17
  import { MAX_BLOCKS_PER_CHECKPOINT } from '../deserialization/index.js';
18
18
  import { computeCheckpointOutHash } from '../messaging/out_hash.js';
19
19
  import { CheckpointHeader } from '../rollup/checkpoint_header.js';
@@ -29,7 +29,7 @@ export class Checkpoint {
29
29
  /** Header of the checkpoint. */
30
30
  public header: CheckpointHeader,
31
31
  /** L2 blocks in the checkpoint. */
32
- public blocks: L2BlockNew[],
32
+ public blocks: L2Block[],
33
33
  /** Number of the checkpoint. */
34
34
  public number: CheckpointNumber,
35
35
  ) {}
@@ -43,7 +43,7 @@ export class Checkpoint {
43
43
  .object({
44
44
  archive: AppendOnlyTreeSnapshot.schema,
45
45
  header: CheckpointHeader.schema,
46
- blocks: z.array(L2BlockNew.schema),
46
+ blocks: z.array(L2Block.schema),
47
47
  number: CheckpointNumberSchema,
48
48
  })
49
49
  .transform(({ archive, header, blocks, number }) => new Checkpoint(archive, header, blocks, number));
@@ -62,7 +62,7 @@ export class Checkpoint {
62
62
  return new Checkpoint(
63
63
  reader.readObject(AppendOnlyTreeSnapshot),
64
64
  reader.readObject(CheckpointHeader),
65
- reader.readVector(L2BlockNew, MAX_BLOCKS_PER_CHECKPOINT),
65
+ reader.readVector(L2Block, MAX_BLOCKS_PER_CHECKPOINT),
66
66
  CheckpointNumber(reader.readNumber()),
67
67
  );
68
68
  }
@@ -135,16 +135,16 @@ export class Checkpoint {
135
135
  startBlockNumber?: number;
136
136
  previousArchive?: AppendOnlyTreeSnapshot;
137
137
  } & Partial<Parameters<typeof CheckpointHeader.random>[0]> &
138
- Partial<Parameters<typeof L2BlockNew.random>[1]> = {},
138
+ Partial<Parameters<typeof L2Block.random>[1]> = {},
139
139
  ) {
140
140
  const header = CheckpointHeader.random(options);
141
141
 
142
142
  // Create blocks sequentially to chain archive roots properly.
143
143
  // Each block's header.lastArchive must equal the previous block's archive.
144
- const blocks: L2BlockNew[] = [];
144
+ const blocks: L2Block[] = [];
145
145
  let lastArchive = previousArchive;
146
146
  for (let i = 0; i < numBlocks; i++) {
147
- const block = await L2BlockNew.random(BlockNumber(startBlockNumber + i), {
147
+ const block = await L2Block.random(BlockNumber(startBlockNumber + i), {
148
148
  indexWithinCheckpoint: IndexWithinCheckpoint(i),
149
149
  ...options,
150
150
  ...(lastArchive ? { lastArchive } : {}),
@@ -21,7 +21,7 @@ export const nodeRpcConfigMappings: ConfigMappingsType<NodeRPCConfig> = {
21
21
  rpcMaxBodySize: {
22
22
  env: 'RPC_MAX_BODY_SIZE',
23
23
  description: 'Maximum allowed batch size for JSON RPC batch requests.',
24
- defaultValue: '50mb',
24
+ defaultValue: '1mb',
25
25
  },
26
26
  };
27
27
 
@@ -87,5 +87,5 @@ export async function computeInitializationHashFromEncodedArgs(
87
87
  encodedArgs: Fr[],
88
88
  ): Promise<Fr> {
89
89
  const argsHash = await computeVarArgsHash(encodedArgs);
90
- return poseidon2HashWithSeparator([initFn, argsHash], GeneratorIndex.CONSTRUCTOR);
90
+ return poseidon2HashWithSeparator([initFn, argsHash], GeneratorIndex.INITIALIZER);
91
91
  }
@@ -13,7 +13,7 @@ import { computePrivateFunctionsRoot } from './private_function.js';
13
13
  *
14
14
  * ```
15
15
  * version = 1
16
- * private_function_leaves = private_functions.map(fn => pedersen([fn.function_selector as Field, fn.vk_hash], GENERATOR__FUNCTION_LEAF))
16
+ * private_function_leaves = private_functions.map(fn => pedersen([fn.function_selector as Field, fn.vk_hash], GENERATOR__PRIVATE_FUNCTION_LEAF))
17
17
  * private_functions_root = merkleize(private_function_leaves)
18
18
  * bytecode_commitment = calculate_commitment(packed_bytecode)
19
19
  * contract_class_id = pedersen([version, artifact_hash, private_functions_root, bytecode_commitment], GENERATOR__CLASS_IDENTIFIER)
@@ -1,5 +1,4 @@
1
1
  import { FUNCTION_TREE_HEIGHT, GeneratorIndex } from '@aztec/constants';
2
- import { pedersenHash } from '@aztec/foundation/crypto/pedersen';
3
2
  import { poseidon2Hash, poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
4
3
  import { Fr } from '@aztec/foundation/curves/bn254';
5
4
  import { type MerkleTree, MerkleTreeCalculator } from '@aztec/foundation/trees';
@@ -32,13 +31,13 @@ function computePrivateFunctionLeaves(fns: PrivateFunction[]): Promise<Buffer[]>
32
31
 
33
32
  /** Returns the leaf for a given private function. */
34
33
  export async function computePrivateFunctionLeaf(fn: PrivateFunction): Promise<Buffer> {
35
- return (await poseidon2HashWithSeparator([fn.selector, fn.vkHash], GeneratorIndex.FUNCTION_LEAF)).toBuffer();
34
+ return (await poseidon2HashWithSeparator([fn.selector, fn.vkHash], GeneratorIndex.PRIVATE_FUNCTION_LEAF)).toBuffer();
36
35
  }
37
36
 
38
37
  async function getPrivateFunctionTreeCalculator(): Promise<MerkleTreeCalculator> {
39
38
  if (!privateFunctionTreeCalculator) {
40
39
  const functionTreeZeroLeaf = (
41
- await pedersenHash(new Array(PRIVATE_FUNCTION_SIZE).fill(0))
40
+ await poseidon2Hash(new Array(PRIVATE_FUNCTION_SIZE).fill(0))
42
41
  ).toBuffer() as Buffer<ArrayBuffer>;
43
42
  privateFunctionTreeCalculator = await MerkleTreeCalculator.create(
44
43
  FUNCTION_TREE_HEIGHT,
@@ -99,7 +99,7 @@ export async function createPrivateFunctionMembershipProof(
99
99
  * contract_class = db.get_contract_class(contract_class_id)
100
100
  *
101
101
  * // Compute function leaf and assert it belongs to the private functions tree
102
- * function_leaf = pedersen([selector as Field, vk_hash], GENERATOR__FUNCTION_LEAF)
102
+ * function_leaf = pedersen([selector as Field, vk_hash], GENERATOR__PRIVATE_FUNCTION_LEAF)
103
103
  * computed_private_function_tree_root = compute_root(function_leaf, private_function_tree_sibling_path)
104
104
  * assert computed_private_function_tree_root == contract_class.private_functions_root
105
105
  *
@@ -0,0 +1,87 @@
1
+ import { EthAddress } from '@aztec/foundation/eth-address';
2
+ import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
3
+
4
+ import { z } from 'zod';
5
+
6
+ /**
7
+ * Symbol for Node.js custom inspect. Using Symbol.for() is the documented way to
8
+ * reference this without importing node:util. In browsers, objects with this symbol
9
+ * simply won't have custom inspect behavior (which is fine).
10
+ * @see https://nodejs.org/api/util.html#utilinspectcustom
11
+ */
12
+ const inspectCustomSymbol = Symbol.for('nodejs.util.inspect.custom');
13
+
14
+ /**
15
+ * Represents a version record for storing in a version file.
16
+ */
17
+ export class DatabaseVersion {
18
+ constructor(
19
+ /** The version of the data on disk. Used to perform upgrades */
20
+ public readonly schemaVersion: number,
21
+ /** The rollup the data pertains to */
22
+ public readonly rollupAddress: EthAddress,
23
+ ) {}
24
+
25
+ public toBuffer(): Buffer {
26
+ return Buffer.from(jsonStringify(this));
27
+ }
28
+
29
+ public static fromBuffer(buf: Buffer): DatabaseVersion {
30
+ try {
31
+ return jsonParseWithSchema(buf.toString('utf-8'), DatabaseVersion.schema);
32
+ } catch (err) {
33
+ throw new Error(`Failed to deserialize version information: ${err}`, { cause: err });
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Compares two versions. If the rollups addresses are different then it returns undefined
39
+ */
40
+ public cmp(other: DatabaseVersion): undefined | -1 | 0 | 1 {
41
+ if (this.rollupAddress.equals(other.rollupAddress)) {
42
+ if (this.schemaVersion < other.schemaVersion) {
43
+ return -1;
44
+ } else if (this.schemaVersion > other.schemaVersion) {
45
+ return 1;
46
+ } else {
47
+ return 0;
48
+ }
49
+ }
50
+ return undefined;
51
+ }
52
+
53
+ /**
54
+ * Checks if two versions exactly match
55
+ */
56
+ public equals(other: DatabaseVersion): boolean {
57
+ return this.cmp(other) === 0;
58
+ }
59
+
60
+ /**
61
+ * Returns the schema for this class
62
+ */
63
+ static get schema() {
64
+ return z
65
+ .object({
66
+ schemaVersion: z.number(),
67
+ rollupAddress: EthAddress.schema,
68
+ })
69
+ .transform(({ schemaVersion, rollupAddress }) => new DatabaseVersion(schemaVersion, rollupAddress));
70
+ }
71
+
72
+ /** Allows for better introspection in Node.js console. Ignored in browser envs. */
73
+ public [inspectCustomSymbol](): string {
74
+ return this.toString();
75
+ }
76
+
77
+ public toString(): string {
78
+ return `DatabaseVersion{schemaVersion=${this.schemaVersion},rollupAddress=${this.rollupAddress}"}`;
79
+ }
80
+
81
+ /**
82
+ * Returns an empty instance
83
+ */
84
+ static empty() {
85
+ return new DatabaseVersion(0, EthAddress.ZERO);
86
+ }
87
+ }
@@ -1,86 +1,10 @@
1
1
  import { EthAddress } from '@aztec/foundation/eth-address';
2
- import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
3
2
  import { type Logger, createLogger } from '@aztec/foundation/log';
4
3
 
5
4
  import fs from 'fs/promises';
6
- import { inspect } from 'node:util';
7
5
  import { join } from 'path';
8
- import { z } from 'zod';
9
6
 
10
- /**
11
- * Represents a version record for storing in a version file.
12
- */
13
- export class DatabaseVersion {
14
- constructor(
15
- /** The version of the data on disk. Used to perform upgrades */
16
- public readonly schemaVersion: number,
17
- /** The rollup the data pertains to */
18
- public readonly rollupAddress: EthAddress,
19
- ) {}
20
-
21
- public toBuffer(): Buffer {
22
- return Buffer.from(jsonStringify(this));
23
- }
24
-
25
- public static fromBuffer(buf: Buffer): DatabaseVersion {
26
- try {
27
- return jsonParseWithSchema(buf.toString('utf-8'), DatabaseVersion.schema);
28
- } catch (err) {
29
- throw new Error(`Failed to deserialize version information: ${err}`, { cause: err });
30
- }
31
- }
32
-
33
- /**
34
- * Compares two versions. If the rollups addresses are different then it returns undefined
35
- */
36
- public cmp(other: DatabaseVersion): undefined | -1 | 0 | 1 {
37
- if (this.rollupAddress.equals(other.rollupAddress)) {
38
- if (this.schemaVersion < other.schemaVersion) {
39
- return -1;
40
- } else if (this.schemaVersion > other.schemaVersion) {
41
- return 1;
42
- } else {
43
- return 0;
44
- }
45
- }
46
- return undefined;
47
- }
48
-
49
- /**
50
- * Checks if two versions exactly match
51
- */
52
- public equals(other: DatabaseVersion): boolean {
53
- return this.cmp(other) === 0;
54
- }
55
-
56
- /**
57
- * Returns the schema for this class
58
- */
59
- static get schema() {
60
- return z
61
- .object({
62
- schemaVersion: z.number(),
63
- rollupAddress: EthAddress.schema,
64
- })
65
- .transform(({ schemaVersion, rollupAddress }) => new DatabaseVersion(schemaVersion, rollupAddress));
66
- }
67
-
68
- /** Allows for better introspection. */
69
- public [inspect.custom](): string {
70
- return this.toString();
71
- }
72
-
73
- public toString(): string {
74
- return `DatabaseVersion{schemaVersion=${this.schemaVersion},rollupAddress=${this.rollupAddress}"}`;
75
- }
76
-
77
- /**
78
- * Returns an empty instance
79
- */
80
- static empty() {
81
- return new DatabaseVersion(0, EthAddress.ZERO);
82
- }
83
- }
7
+ import { DatabaseVersion } from './database_version.js';
84
8
 
85
9
  export type DatabaseVersionManagerFs = Pick<typeof fs, 'readFile' | 'writeFile' | 'rm' | 'mkdir'>;
86
10
 
@@ -68,23 +68,22 @@ export class DelayedPublicMutableValues {
68
68
  }
69
69
 
70
70
  static async readFromTree(delayedPublicMutableSlot: Fr, readStorage: (storageSlot: Fr) => Promise<Fr>) {
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);
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));
76
75
  }
77
76
 
78
77
  isEmpty(): boolean {
79
78
  return this.svc.isEmpty() && this.sdc.isEmpty();
80
79
  }
81
80
 
82
- async writeToTree(delayedPublicMutableSlot: Fr, storageWrite: (storageSlot: Fr, value: Fr) => Promise<void>) {
83
- const fields = this.toFields();
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
+ );
84
85
 
85
- for (let i = 0; i < fields.length; i++) {
86
- await storageWrite(delayedPublicMutableSlot.add(new Fr(i)), fields[i]);
87
- }
86
+ return Promise.all(fieldPromises);
88
87
  }
89
88
 
90
89
  async hash(): Promise<Fr> {
@@ -51,6 +51,15 @@ export function getSlotAtTimestamp(
51
51
  : SlotNumber.fromBigInt((ts - constants.l1GenesisTime) / BigInt(constants.slotDuration));
52
52
  }
53
53
 
54
+ /** Returns the L2 slot number at the next L1 block based on the current timestamp. */
55
+ export function getSlotAtNextL1Block(
56
+ currentL1Timestamp: bigint,
57
+ constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'ethereumSlotDuration'>,
58
+ ): SlotNumber {
59
+ const nextL1BlockTimestamp = currentL1Timestamp + BigInt(constants.ethereumSlotDuration);
60
+ return getSlotAtTimestamp(nextL1BlockTimestamp, constants);
61
+ }
62
+
54
63
  /** Returns the epoch number for a given timestamp. */
55
64
  export function getEpochNumberAtTimestamp(
56
65
  ts: bigint,
@@ -69,7 +78,7 @@ export function getSlotRangeForEpoch(
69
78
  epochNumber: EpochNumber,
70
79
  constants: Pick<L1RollupConstants, 'epochDuration'>,
71
80
  ): [SlotNumber, SlotNumber] {
72
- const startSlot = SlotNumber(epochNumber * constants.epochDuration);
81
+ const startSlot = SlotNumber(Number(epochNumber) * constants.epochDuration);
73
82
  return [startSlot, SlotNumber(startSlot + constants.epochDuration - 1)];
74
83
  }
75
84
 
package/src/hash/hash.ts CHANGED
@@ -55,7 +55,7 @@ export function computeUniqueNoteHash(noteNonce: Fr, siloedNoteHash: Fr): Promis
55
55
  * @returns A siloed nullifier.
56
56
  */
57
57
  export function siloNullifier(contract: AztecAddress, innerNullifier: Fr): Promise<Fr> {
58
- return poseidon2HashWithSeparator([contract, innerNullifier], GeneratorIndex.OUTER_NULLIFIER);
58
+ return poseidon2HashWithSeparator([contract, innerNullifier], GeneratorIndex.SILOED_NULLIFIER);
59
59
  }
60
60
 
61
61
  /**
@@ -87,7 +87,7 @@ export function computePublicDataTreeValue(value: Fr): Fr {
87
87
 
88
88
  */
89
89
  export function computePublicDataTreeLeafSlot(contractAddress: AztecAddress, storageSlot: Fr): Promise<Fr> {
90
- return poseidon2HashWithSeparator([contractAddress, storageSlot], GeneratorIndex.PUBLIC_LEAF_INDEX);
90
+ return poseidon2HashWithSeparator([contractAddress, storageSlot], GeneratorIndex.PUBLIC_LEAF_SLOT);
91
91
  }
92
92
 
93
93
  /**
@@ -1,4 +1,5 @@
1
- import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
1
+ import { GeneratorIndex } from '@aztec/constants';
2
+ import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
2
3
  import type { Fr } from '@aztec/foundation/curves/bn254';
3
4
 
4
5
  /**
@@ -14,5 +15,5 @@ export function deriveStorageSlotInMap(
14
15
  toField: () => Fr;
15
16
  },
16
17
  ): Promise<Fr> {
17
- return poseidon2Hash([mapSlot, key.toField()]);
18
+ return poseidon2HashWithSeparator([mapSlot, key.toField()], GeneratorIndex.PUBLIC_STORAGE_MAP_SLOT);
18
19
  }
@@ -2,3 +2,4 @@ export const MAX_RPC_LEN = 100;
2
2
  export const MAX_RPC_TXS_LEN = 50;
3
3
  export const MAX_RPC_BLOCKS_LEN = 50;
4
4
  export const MAX_RPC_CHECKPOINTS_LEN = 50;
5
+ export const MAX_LOGS_PER_TAG = 10;
@@ -4,8 +4,9 @@ import type { ApiSchemaFor } from '@aztec/foundation/schemas';
4
4
 
5
5
  import { z } from 'zod';
6
6
 
7
+ import { BlockHash } from '../block/block_hash.js';
7
8
  import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
8
- import { L2BlockNew } from '../block/l2_block_new.js';
9
+ import { L2Block } from '../block/l2_block.js';
9
10
  import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
10
11
  import { ValidateCheckpointResultSchema } from '../block/validate_block_result.js';
11
12
  import { Checkpoint } from '../checkpoint/checkpoint.js';
@@ -82,7 +83,9 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
82
83
  getRegistryAddress: z.function().args().returns(schemas.EthAddress),
83
84
  getBlockNumber: z.function().args().returns(BlockNumberSchema),
84
85
  getProvenBlockNumber: z.function().args().returns(BlockNumberSchema),
85
- getBlock: z.function().args(BlockNumberSchema).returns(L2BlockNew.schema.optional()),
86
+ getCheckpointedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
87
+ getFinalizedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
88
+ getBlock: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
86
89
  getBlockHeader: z
87
90
  .function()
88
91
  .args(z.union([BlockNumberSchema, z.literal('latest')]))
@@ -90,48 +93,37 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
90
93
  getCheckpointedBlock: z.function().args(BlockNumberSchema).returns(CheckpointedL2Block.schema.optional()),
91
94
  getCheckpointedBlocks: z
92
95
  .function()
93
- .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
96
+ .args(BlockNumberSchema, schemas.Integer)
94
97
  .returns(z.array(CheckpointedL2Block.schema)),
95
- getBlocks: z
96
- .function()
97
- .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
98
- .returns(z.array(L2BlockNew.schema)),
99
- getPublishedCheckpoints: z
98
+ getBlocks: z.function().args(BlockNumberSchema, schemas.Integer).returns(z.array(L2Block.schema)),
99
+ getCheckpoints: z
100
100
  .function()
101
101
  .args(CheckpointNumberSchema, schemas.Integer)
102
102
  .returns(z.array(PublishedCheckpoint.schema)),
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()),
113
- getBlockHeaderByHash: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
103
+ getCheckpointedBlockByHash: z.function().args(BlockHash.schema).returns(CheckpointedL2Block.schema.optional()),
104
+ getCheckpointedBlockByArchive: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
105
+ getBlockHeaderByHash: z.function().args(BlockHash.schema).returns(BlockHeader.schema.optional()),
114
106
  getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.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()),
107
+ getL2Block: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
108
+ getL2BlockByHash: z.function().args(BlockHash.schema).returns(L2Block.schema.optional()),
109
+ getL2BlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
118
110
  getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
119
111
  getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
120
112
  getL2SlotNumber: z.function().args().returns(schemas.SlotNumber.optional()),
121
113
  getL2EpochNumber: z.function().args().returns(EpochNumberSchema.optional()),
122
114
  getCheckpointsForEpoch: z.function().args(EpochNumberSchema).returns(z.array(Checkpoint.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)),
115
+ getCheckpointedBlocksForEpoch: z.function().args(EpochNumberSchema).returns(z.array(CheckpointedL2Block.schema)),
116
+ getBlocksForSlot: z.function().args(schemas.SlotNumber).returns(z.array(L2Block.schema)),
117
+ getCheckpointedBlockHeadersForEpoch: z.function().args(EpochNumberSchema).returns(z.array(BlockHeader.schema)),
126
118
  isEpochComplete: z.function().args(EpochNumberSchema).returns(z.boolean()),
127
119
  getL2Tips: z.function().args().returns(L2TipsSchema),
128
120
  getPrivateLogsByTags: z
129
121
  .function()
130
- .args(z.array(SiloedTag.schema))
122
+ .args(z.array(SiloedTag.schema), optional(z.number().gte(0)))
131
123
  .returns(z.array(z.array(TxScopedL2Log.schema))),
132
124
  getPublicLogsByTagsFromContract: z
133
125
  .function()
134
- .args(schemas.AztecAddress, z.array(Tag.schema))
126
+ .args(schemas.AztecAddress, z.array(Tag.schema), optional(z.number().gte(0)))
135
127
  .returns(z.array(z.array(TxScopedL2Log.schema))),
136
128
  getPublicLogs: z.function().args(LogFilterSchema).returns(GetPublicLogsResponseSchema),
137
129
  getContractClassLogs: z.function().args(LogFilterSchema).returns(GetContractClassLogsResponseSchema),