@aztec/archiver 0.0.1-commit.3469e52 → 0.0.1-commit.35158ae7e

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 (107) hide show
  1. package/README.md +9 -0
  2. package/dest/archiver.d.ts +12 -9
  3. package/dest/archiver.d.ts.map +1 -1
  4. package/dest/archiver.js +98 -124
  5. package/dest/config.d.ts +3 -3
  6. package/dest/config.d.ts.map +1 -1
  7. package/dest/config.js +2 -1
  8. package/dest/errors.d.ts +26 -9
  9. package/dest/errors.d.ts.map +1 -1
  10. package/dest/errors.js +34 -13
  11. package/dest/factory.d.ts +4 -2
  12. package/dest/factory.d.ts.map +1 -1
  13. package/dest/factory.js +29 -23
  14. package/dest/index.d.ts +2 -1
  15. package/dest/index.d.ts.map +1 -1
  16. package/dest/index.js +1 -0
  17. package/dest/l1/bin/retrieve-calldata.js +35 -32
  18. package/dest/l1/calldata_retriever.d.ts +73 -50
  19. package/dest/l1/calldata_retriever.d.ts.map +1 -1
  20. package/dest/l1/calldata_retriever.js +190 -259
  21. package/dest/l1/data_retrieval.d.ts +9 -9
  22. package/dest/l1/data_retrieval.d.ts.map +1 -1
  23. package/dest/l1/data_retrieval.js +24 -22
  24. package/dest/l1/spire_proposer.d.ts +5 -5
  25. package/dest/l1/spire_proposer.d.ts.map +1 -1
  26. package/dest/l1/spire_proposer.js +9 -17
  27. package/dest/l1/validate_trace.d.ts +6 -3
  28. package/dest/l1/validate_trace.d.ts.map +1 -1
  29. package/dest/l1/validate_trace.js +13 -9
  30. package/dest/modules/data_source_base.d.ts +27 -23
  31. package/dest/modules/data_source_base.d.ts.map +1 -1
  32. package/dest/modules/data_source_base.js +49 -124
  33. package/dest/modules/data_store_updater.d.ts +42 -26
  34. package/dest/modules/data_store_updater.d.ts.map +1 -1
  35. package/dest/modules/data_store_updater.js +149 -129
  36. package/dest/modules/instrumentation.d.ts +17 -4
  37. package/dest/modules/instrumentation.d.ts.map +1 -1
  38. package/dest/modules/instrumentation.js +36 -12
  39. package/dest/modules/l1_synchronizer.d.ts +5 -8
  40. package/dest/modules/l1_synchronizer.d.ts.map +1 -1
  41. package/dest/modules/l1_synchronizer.js +59 -25
  42. package/dest/store/block_store.d.ts +49 -32
  43. package/dest/store/block_store.d.ts.map +1 -1
  44. package/dest/store/block_store.js +188 -95
  45. package/dest/store/contract_class_store.d.ts +2 -3
  46. package/dest/store/contract_class_store.d.ts.map +1 -1
  47. package/dest/store/contract_class_store.js +16 -72
  48. package/dest/store/contract_instance_store.d.ts +1 -1
  49. package/dest/store/contract_instance_store.d.ts.map +1 -1
  50. package/dest/store/contract_instance_store.js +6 -2
  51. package/dest/store/kv_archiver_store.d.ts +64 -36
  52. package/dest/store/kv_archiver_store.d.ts.map +1 -1
  53. package/dest/store/kv_archiver_store.js +63 -29
  54. package/dest/store/l2_tips_cache.d.ts +19 -0
  55. package/dest/store/l2_tips_cache.d.ts.map +1 -0
  56. package/dest/store/l2_tips_cache.js +89 -0
  57. package/dest/store/log_store.d.ts +9 -6
  58. package/dest/store/log_store.d.ts.map +1 -1
  59. package/dest/store/log_store.js +150 -53
  60. package/dest/store/message_store.d.ts +5 -1
  61. package/dest/store/message_store.d.ts.map +1 -1
  62. package/dest/store/message_store.js +14 -1
  63. package/dest/test/fake_l1_state.d.ts +16 -4
  64. package/dest/test/fake_l1_state.d.ts.map +1 -1
  65. package/dest/test/fake_l1_state.js +95 -23
  66. package/dest/test/index.js +3 -1
  67. package/dest/test/mock_archiver.d.ts +1 -1
  68. package/dest/test/mock_archiver.d.ts.map +1 -1
  69. package/dest/test/mock_archiver.js +3 -2
  70. package/dest/test/mock_l2_block_source.d.ts +39 -23
  71. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  72. package/dest/test/mock_l2_block_source.js +157 -112
  73. package/dest/test/mock_structs.d.ts +6 -2
  74. package/dest/test/mock_structs.d.ts.map +1 -1
  75. package/dest/test/mock_structs.js +24 -10
  76. package/dest/test/noop_l1_archiver.d.ts +26 -0
  77. package/dest/test/noop_l1_archiver.d.ts.map +1 -0
  78. package/dest/test/noop_l1_archiver.js +72 -0
  79. package/package.json +14 -13
  80. package/src/archiver.ts +126 -151
  81. package/src/config.ts +8 -1
  82. package/src/errors.ts +52 -24
  83. package/src/factory.ts +46 -22
  84. package/src/index.ts +1 -0
  85. package/src/l1/README.md +25 -68
  86. package/src/l1/bin/retrieve-calldata.ts +45 -33
  87. package/src/l1/calldata_retriever.ts +249 -379
  88. package/src/l1/data_retrieval.ts +27 -29
  89. package/src/l1/spire_proposer.ts +7 -15
  90. package/src/l1/validate_trace.ts +24 -6
  91. package/src/modules/data_source_base.ts +84 -169
  92. package/src/modules/data_store_updater.ts +166 -161
  93. package/src/modules/instrumentation.ts +46 -14
  94. package/src/modules/l1_synchronizer.ts +72 -36
  95. package/src/store/block_store.ts +239 -140
  96. package/src/store/contract_class_store.ts +16 -110
  97. package/src/store/contract_instance_store.ts +8 -5
  98. package/src/store/kv_archiver_store.ts +104 -53
  99. package/src/store/l2_tips_cache.ts +89 -0
  100. package/src/store/log_store.ts +231 -70
  101. package/src/store/message_store.ts +20 -1
  102. package/src/test/fake_l1_state.ts +127 -28
  103. package/src/test/index.ts +3 -0
  104. package/src/test/mock_archiver.ts +3 -2
  105. package/src/test/mock_l2_block_source.ts +211 -129
  106. package/src/test/mock_structs.ts +45 -15
  107. package/src/test/noop_l1_archiver.ts +115 -0
@@ -1,11 +1,12 @@
1
+ import { range } from '@aztec/foundation/array';
1
2
  import { BlockNumber, CheckpointNumber, type EpochNumber, type SlotNumber } from '@aztec/foundation/branded-types';
2
3
  import type { Fr } from '@aztec/foundation/curves/bn254';
3
4
  import type { EthAddress } from '@aztec/foundation/eth-address';
4
5
  import { isDefined } from '@aztec/foundation/types';
5
6
  import type { FunctionSelector } from '@aztec/stdlib/abi';
6
7
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
- import { CheckpointedL2Block, CommitteeAttestation, L2BlockNew, type L2Tips } from '@aztec/stdlib/block';
8
- import { Checkpoint, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
8
+ import { type BlockData, type BlockHash, CheckpointedL2Block, L2Block, type L2Tips } from '@aztec/stdlib/block';
9
+ import { Checkpoint, type CheckpointData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
9
10
  import type { ContractClassPublic, ContractDataSource, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
10
11
  import { type L1RollupConstants, getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
11
12
  import type { GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
@@ -17,7 +18,6 @@ import type { BlockHeader, IndexedTxEffect, TxHash, TxReceipt } from '@aztec/std
17
18
  import type { UInt64 } from '@aztec/stdlib/types';
18
19
 
19
20
  import type { ArchiverDataSource } from '../interfaces.js';
20
- import type { CheckpointData } from '../store/block_store.js';
21
21
  import type { KVArchiverDataStore } from '../store/kv_archiver_store.js';
22
22
  import type { ValidateCheckpointResult } from './validation.js';
23
23
 
@@ -46,9 +46,9 @@ export abstract class ArchiverDataSourceBase
46
46
 
47
47
  abstract getL2Tips(): Promise<L2Tips>;
48
48
 
49
- abstract getL2SlotNumber(): Promise<SlotNumber | undefined>;
49
+ abstract getSyncedL2SlotNumber(): Promise<SlotNumber | undefined>;
50
50
 
51
- abstract getL2EpochNumber(): Promise<EpochNumber | undefined>;
51
+ abstract getSyncedL2EpochNumber(): Promise<EpochNumber | undefined>;
52
52
 
53
53
  abstract isEpochComplete(epochNumber: EpochNumber): Promise<boolean>;
54
54
 
@@ -87,10 +87,14 @@ export abstract class ArchiverDataSourceBase
87
87
  return this.store.getCheckpointedBlock(number);
88
88
  }
89
89
 
90
- public getCheckpointedBlockNumber(): Promise<BlockNumber> {
90
+ public getCheckpointedL2BlockNumber(): Promise<BlockNumber> {
91
91
  return this.store.getCheckpointedL2BlockNumber();
92
92
  }
93
93
 
94
+ public getFinalizedL2BlockNumber(): Promise<BlockNumber> {
95
+ return this.store.getFinalizedL2BlockNumber();
96
+ }
97
+
94
98
  public async getCheckpointHeader(number: CheckpointNumber | 'latest'): Promise<CheckpointHeader | undefined> {
95
99
  if (number === 'latest') {
96
100
  number = await this.store.getSynchedCheckpointNumber();
@@ -110,24 +114,14 @@ export abstract class ArchiverDataSourceBase
110
114
  if (!checkpointData) {
111
115
  return undefined;
112
116
  }
113
- return BlockNumber(checkpointData.startBlock + checkpointData.numBlocks - 1);
117
+ return BlockNumber(checkpointData.startBlock + checkpointData.blockCount - 1);
114
118
  }
115
119
 
116
- public async getCheckpointedBlocks(
117
- from: BlockNumber,
118
- limit: number,
119
- proven?: boolean,
120
- ): Promise<CheckpointedL2Block[]> {
121
- const blocks = await this.store.getCheckpointedBlocks(from, limit);
122
-
123
- if (proven === true) {
124
- const provenBlockNumber = await this.store.getProvenBlockNumber();
125
- return blocks.filter(b => b.block.number <= provenBlockNumber);
126
- }
127
- return blocks;
120
+ public getCheckpointedBlocks(from: BlockNumber, limit: number): Promise<CheckpointedL2Block[]> {
121
+ return this.store.getCheckpointedBlocks(from, limit);
128
122
  }
129
123
 
130
- public getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined> {
124
+ public getBlockHeaderByHash(blockHash: BlockHash): Promise<BlockHeader | undefined> {
131
125
  return this.store.getBlockHeaderByHash(blockHash);
132
126
  }
133
127
 
@@ -135,7 +129,15 @@ export abstract class ArchiverDataSourceBase
135
129
  return this.store.getBlockHeaderByArchive(archive);
136
130
  }
137
131
 
138
- public async getL2BlockNew(number: BlockNumber): Promise<L2BlockNew | undefined> {
132
+ public getBlockData(number: BlockNumber): Promise<BlockData | undefined> {
133
+ return this.store.getBlockData(number);
134
+ }
135
+
136
+ public getBlockDataByArchive(archive: Fr): Promise<BlockData | undefined> {
137
+ return this.store.getBlockDataByArchive(archive);
138
+ }
139
+
140
+ public async getL2Block(number: BlockNumber): Promise<L2Block | undefined> {
139
141
  // If the number provided is -ve, then return the latest block.
140
142
  if (number < 0) {
141
143
  number = await this.store.getLatestBlockNumber();
@@ -152,7 +154,7 @@ export abstract class ArchiverDataSourceBase
152
154
  }
153
155
 
154
156
  public getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined> {
155
- return this.store.getSettledTxReceipt(txHash);
157
+ return this.store.getSettledTxReceipt(txHash, this.l1Constants);
156
158
  }
157
159
 
158
160
  public isPendingChainInvalid(): Promise<boolean> {
@@ -163,26 +165,21 @@ export abstract class ArchiverDataSourceBase
163
165
  return (await this.store.getPendingChainValidationStatus()) ?? { valid: true };
164
166
  }
165
167
 
166
- public async getL2BlocksNew(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]> {
167
- const blocks = await this.store.getBlocks(from, limit);
168
-
169
- if (proven === true) {
170
- const provenBlockNumber = await this.store.getProvenBlockNumber();
171
- return blocks.filter(b => b.number <= provenBlockNumber);
172
- }
173
- return blocks;
174
- }
175
-
176
- public getPrivateLogsByTags(tags: SiloedTag[], page?: number): Promise<TxScopedL2Log[][]> {
177
- return this.store.getPrivateLogsByTags(tags, page);
168
+ public getPrivateLogsByTags(
169
+ tags: SiloedTag[],
170
+ page?: number,
171
+ upToBlockNumber?: BlockNumber,
172
+ ): Promise<TxScopedL2Log[][]> {
173
+ return this.store.getPrivateLogsByTags(tags, page, upToBlockNumber);
178
174
  }
179
175
 
180
176
  public getPublicLogsByTagsFromContract(
181
177
  contractAddress: AztecAddress,
182
178
  tags: Tag[],
183
179
  page?: number,
180
+ upToBlockNumber?: BlockNumber,
184
181
  ): Promise<TxScopedL2Log[][]> {
185
- return this.store.getPublicLogsByTagsFromContract(contractAddress, tags, page);
182
+ return this.store.getPublicLogsByTagsFromContract(contractAddress, tags, page, upToBlockNumber);
186
183
  }
187
184
 
188
185
  public getPublicLogs(filter: LogFilter): Promise<GetPublicLogsResponse> {
@@ -237,147 +234,71 @@ export abstract class ArchiverDataSourceBase
237
234
  return this.store.getL1ToL2MessageIndex(l1ToL2Message);
238
235
  }
239
236
 
240
- public async getPublishedCheckpoints(
241
- checkpointNumber: CheckpointNumber,
242
- limit: number,
243
- ): Promise<PublishedCheckpoint[]> {
237
+ public async getCheckpoints(checkpointNumber: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]> {
244
238
  const checkpoints = await this.store.getRangeOfCheckpoints(checkpointNumber, limit);
245
- const blocks = (
246
- await Promise.all(checkpoints.map(ch => this.store.getBlocksForCheckpoint(ch.checkpointNumber)))
247
- ).filter(isDefined);
248
-
249
- const fullCheckpoints: PublishedCheckpoint[] = [];
250
- for (let i = 0; i < checkpoints.length; i++) {
251
- const blocksForCheckpoint = blocks[i];
252
- const checkpoint = checkpoints[i];
253
- const fullCheckpoint = new Checkpoint(
254
- checkpoint.archive,
255
- checkpoint.header,
256
- blocksForCheckpoint,
257
- checkpoint.checkpointNumber,
258
- );
259
- const publishedCheckpoint = new PublishedCheckpoint(
260
- fullCheckpoint,
261
- checkpoint.l1,
262
- checkpoint.attestations.map(x => CommitteeAttestation.fromBuffer(x)),
263
- );
264
- fullCheckpoints.push(publishedCheckpoint);
239
+ return Promise.all(checkpoints.map(ch => this.getPublishedCheckpointFromCheckpointData(ch)));
240
+ }
241
+
242
+ private async getPublishedCheckpointFromCheckpointData(checkpoint: CheckpointData): Promise<PublishedCheckpoint> {
243
+ const blocksForCheckpoint = await this.store.getBlocksForCheckpoint(checkpoint.checkpointNumber);
244
+ if (!blocksForCheckpoint) {
245
+ throw new Error(`Blocks for checkpoint ${checkpoint.checkpointNumber} not found`);
265
246
  }
266
- return fullCheckpoints;
247
+ const fullCheckpoint = new Checkpoint(
248
+ checkpoint.archive,
249
+ checkpoint.header,
250
+ blocksForCheckpoint,
251
+ checkpoint.checkpointNumber,
252
+ );
253
+ return new PublishedCheckpoint(fullCheckpoint, checkpoint.l1, checkpoint.attestations);
267
254
  }
268
255
 
269
- public getBlocksForSlot(slotNumber: SlotNumber): Promise<L2BlockNew[]> {
256
+ public getBlocksForSlot(slotNumber: SlotNumber): Promise<L2Block[]> {
270
257
  return this.store.getBlocksForSlot(slotNumber);
271
258
  }
272
259
 
273
- public async getBlocksForEpoch(epochNumber: EpochNumber): Promise<L2BlockNew[]> {
274
- if (!this.l1Constants) {
275
- throw new Error('L1 constants not set');
276
- }
277
-
278
- const [start, end] = getSlotRangeForEpoch(epochNumber, this.l1Constants);
279
- const blocks: L2BlockNew[] = [];
280
-
281
- // Walk the list of checkpoints backwards and filter by slots matching the requested epoch.
282
- // We'll typically ask for checkpoints for a very recent epoch, so we shouldn't need an index here.
283
- let checkpoint = await this.store.getCheckpointData(await this.store.getSynchedCheckpointNumber());
284
- const slot = (b: CheckpointData) => b.header.slotNumber;
285
- while (checkpoint && slot(checkpoint) >= start) {
286
- if (slot(checkpoint) <= end) {
287
- // push the blocks on backwards
288
- const endBlock = checkpoint.startBlock + checkpoint.numBlocks - 1;
289
- for (let i = endBlock; i >= checkpoint.startBlock; i--) {
290
- const block = await this.getBlock(BlockNumber(i));
291
- if (block) {
292
- blocks.push(block);
293
- }
294
- }
295
- }
296
- checkpoint = await this.store.getCheckpointData(CheckpointNumber(checkpoint.checkpointNumber - 1));
297
- }
298
-
299
- return blocks.reverse();
260
+ public async getCheckpointedBlocksForEpoch(epochNumber: EpochNumber): Promise<CheckpointedL2Block[]> {
261
+ const checkpointsData = await this.getCheckpointsDataForEpoch(epochNumber);
262
+ const blocks = await Promise.all(
263
+ checkpointsData.flatMap(checkpoint =>
264
+ range(checkpoint.blockCount, checkpoint.startBlock).map(blockNumber =>
265
+ this.getCheckpointedBlock(BlockNumber(blockNumber)),
266
+ ),
267
+ ),
268
+ );
269
+ return blocks.filter(isDefined);
300
270
  }
301
271
 
302
- public async getBlockHeadersForEpoch(epochNumber: EpochNumber): Promise<BlockHeader[]> {
303
- if (!this.l1Constants) {
304
- throw new Error('L1 constants not set');
305
- }
306
-
307
- const [start, end] = getSlotRangeForEpoch(epochNumber, this.l1Constants);
308
- const blocks: BlockHeader[] = [];
309
-
310
- // Walk the list of checkpoints backwards and filter by slots matching the requested epoch.
311
- // We'll typically ask for checkpoints for a very recent epoch, so we shouldn't need an index here.
312
- let checkpoint = await this.store.getCheckpointData(await this.store.getSynchedCheckpointNumber());
313
- const slot = (b: CheckpointData) => b.header.slotNumber;
314
- while (checkpoint && slot(checkpoint) >= start) {
315
- if (slot(checkpoint) <= end) {
316
- // push the blocks on backwards
317
- const endBlock = checkpoint.startBlock + checkpoint.numBlocks - 1;
318
- for (let i = endBlock; i >= checkpoint.startBlock; i--) {
319
- const block = await this.getBlockHeader(BlockNumber(i));
320
- if (block) {
321
- blocks.push(block);
322
- }
323
- }
324
- }
325
- checkpoint = await this.store.getCheckpointData(CheckpointNumber(checkpoint.checkpointNumber - 1));
326
- }
327
- return blocks.reverse();
272
+ public async getCheckpointedBlockHeadersForEpoch(epochNumber: EpochNumber): Promise<BlockHeader[]> {
273
+ const checkpointsData = await this.getCheckpointsDataForEpoch(epochNumber);
274
+ const blocks = await Promise.all(
275
+ checkpointsData.flatMap(checkpoint =>
276
+ range(checkpoint.blockCount, checkpoint.startBlock).map(blockNumber =>
277
+ this.getBlockHeader(BlockNumber(blockNumber)),
278
+ ),
279
+ ),
280
+ );
281
+ return blocks.filter(isDefined);
328
282
  }
329
283
 
330
284
  public async getCheckpointsForEpoch(epochNumber: EpochNumber): Promise<Checkpoint[]> {
285
+ const checkpointsData = await this.getCheckpointsDataForEpoch(epochNumber);
286
+ return Promise.all(
287
+ checkpointsData.map(data => this.getPublishedCheckpointFromCheckpointData(data).then(p => p.checkpoint)),
288
+ );
289
+ }
290
+
291
+ /** Returns checkpoint data for all checkpoints whose slot falls within the given epoch. */
292
+ public getCheckpointsDataForEpoch(epochNumber: EpochNumber): Promise<CheckpointData[]> {
331
293
  if (!this.l1Constants) {
332
294
  throw new Error('L1 constants not set');
333
295
  }
334
296
 
335
297
  const [start, end] = getSlotRangeForEpoch(epochNumber, this.l1Constants);
336
- const checkpoints: Checkpoint[] = [];
337
-
338
- // Walk the list of checkpoints backwards and filter by slots matching the requested epoch.
339
- // We'll typically ask for checkpoints for a very recent epoch, so we shouldn't need an index here.
340
- let checkpointData = await this.store.getCheckpointData(await this.store.getSynchedCheckpointNumber());
341
- const slot = (b: CheckpointData) => b.header.slotNumber;
342
- while (checkpointData && slot(checkpointData) >= start) {
343
- if (slot(checkpointData) <= end) {
344
- // push the checkpoints on backwards
345
- const [checkpoint] = await this.getPublishedCheckpoints(checkpointData.checkpointNumber, 1);
346
- checkpoints.push(checkpoint.checkpoint);
347
- }
348
- checkpointData = await this.store.getCheckpointData(CheckpointNumber(checkpointData.checkpointNumber - 1));
349
- }
350
-
351
- return checkpoints.reverse();
352
- }
353
-
354
- public async getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<CheckpointedL2Block[]> {
355
- const checkpoints = await this.store.getRangeOfCheckpoints(CheckpointNumber(from), limit);
356
- const provenCheckpointNumber = await this.store.getProvenCheckpointNumber();
357
- const blocks = (
358
- await Promise.all(checkpoints.map(ch => this.store.getBlocksForCheckpoint(ch.checkpointNumber)))
359
- ).filter(isDefined);
360
-
361
- const publishedBlocks: CheckpointedL2Block[] = [];
362
- for (let i = 0; i < checkpoints.length; i++) {
363
- const blockForCheckpoint = blocks[i][0];
364
- const checkpoint = checkpoints[i];
365
- if (checkpoint.checkpointNumber > provenCheckpointNumber && proven === true) {
366
- // this checkpoint isn't proven and we only want proven
367
- continue;
368
- }
369
- const publishedBlock = new CheckpointedL2Block(
370
- checkpoint.checkpointNumber,
371
- blockForCheckpoint,
372
- checkpoint.l1,
373
- checkpoint.attestations.map(x => CommitteeAttestation.fromBuffer(x)),
374
- );
375
- publishedBlocks.push(publishedBlock);
376
- }
377
- return publishedBlocks;
298
+ return this.store.getCheckpointDataForSlotRange(start, end);
378
299
  }
379
300
 
380
- public async getBlock(number: BlockNumber): Promise<L2BlockNew | undefined> {
301
+ public async getBlock(number: BlockNumber): Promise<L2Block | undefined> {
381
302
  // If the number provided is -ve, then return the latest block.
382
303
  if (number < 0) {
383
304
  number = await this.store.getLatestBlockNumber();
@@ -388,30 +309,24 @@ export abstract class ArchiverDataSourceBase
388
309
  return this.store.getBlock(number);
389
310
  }
390
311
 
391
- public async getBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]> {
392
- const blocks = await this.store.getBlocks(from, limit);
393
-
394
- if (proven === true) {
395
- const provenBlockNumber = await this.store.getProvenBlockNumber();
396
- return blocks.filter(b => b.number <= provenBlockNumber);
397
- }
398
- return blocks;
312
+ public getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]> {
313
+ return this.store.getBlocks(from, limit);
399
314
  }
400
315
 
401
- public getPublishedBlockByHash(blockHash: Fr): Promise<CheckpointedL2Block | undefined> {
316
+ public getCheckpointedBlockByHash(blockHash: BlockHash): Promise<CheckpointedL2Block | undefined> {
402
317
  return this.store.getCheckpointedBlockByHash(blockHash);
403
318
  }
404
319
 
405
- public getPublishedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined> {
320
+ public getCheckpointedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined> {
406
321
  return this.store.getCheckpointedBlockByArchive(archive);
407
322
  }
408
323
 
409
- public async getL2BlockNewByHash(blockHash: Fr): Promise<L2BlockNew | undefined> {
324
+ public async getL2BlockByHash(blockHash: BlockHash): Promise<L2Block | undefined> {
410
325
  const checkpointedBlock = await this.store.getCheckpointedBlockByHash(blockHash);
411
326
  return checkpointedBlock?.block;
412
327
  }
413
328
 
414
- public async getL2BlockNewByArchive(archive: Fr): Promise<L2BlockNew | undefined> {
329
+ public async getL2BlockByArchive(archive: Fr): Promise<L2Block | undefined> {
415
330
  const checkpointedBlock = await this.store.getCheckpointedBlockByArchive(archive);
416
331
  return checkpointedBlock?.block;
417
332
  }