@aztec/archiver 0.51.0 → 0.52.0

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 (61) hide show
  1. package/README.md +1 -1
  2. package/dest/archiver/archiver.d.ts +10 -4
  3. package/dest/archiver/archiver.d.ts.map +1 -1
  4. package/dest/archiver/archiver.js +87 -41
  5. package/dest/archiver/archiver_store.d.ts +7 -4
  6. package/dest/archiver/archiver_store.d.ts.map +1 -1
  7. package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -1
  8. package/dest/archiver/archiver_store_test_suite.js +46 -34
  9. package/dest/archiver/data_retrieval.d.ts +3 -14
  10. package/dest/archiver/data_retrieval.d.ts.map +1 -1
  11. package/dest/archiver/data_retrieval.js +8 -8
  12. package/dest/archiver/eth_log_handlers.d.ts +8 -6
  13. package/dest/archiver/eth_log_handlers.d.ts.map +1 -1
  14. package/dest/archiver/eth_log_handlers.js +25 -16
  15. package/dest/archiver/index.d.ts +1 -0
  16. package/dest/archiver/index.d.ts.map +1 -1
  17. package/dest/archiver/index.js +1 -1
  18. package/dest/archiver/instrumentation.d.ts +10 -0
  19. package/dest/archiver/instrumentation.d.ts.map +1 -1
  20. package/dest/archiver/instrumentation.js +32 -2
  21. package/dest/archiver/kv_archiver_store/block_body_store.d.ts +1 -1
  22. package/dest/archiver/kv_archiver_store/block_body_store.d.ts.map +1 -1
  23. package/dest/archiver/kv_archiver_store/block_store.d.ts +5 -7
  24. package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
  25. package/dest/archiver/kv_archiver_store/block_store.js +20 -28
  26. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +5 -4
  27. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
  28. package/dest/archiver/kv_archiver_store/kv_archiver_store.js +10 -6
  29. package/dest/archiver/kv_archiver_store/message_store.d.ts +1 -1
  30. package/dest/archiver/kv_archiver_store/message_store.d.ts.map +1 -1
  31. package/dest/archiver/kv_archiver_store/proven_store.d.ts +14 -0
  32. package/dest/archiver/kv_archiver_store/proven_store.d.ts.map +1 -0
  33. package/dest/archiver/kv_archiver_store/proven_store.js +30 -0
  34. package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts +6 -4
  35. package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts.map +1 -1
  36. package/dest/archiver/memory_archiver_store/memory_archiver_store.js +16 -10
  37. package/dest/archiver/structs/data_retrieval.d.ts +27 -0
  38. package/dest/archiver/structs/data_retrieval.d.ts.map +1 -0
  39. package/dest/archiver/structs/data_retrieval.js +2 -0
  40. package/dest/archiver/structs/published.d.ts +11 -0
  41. package/dest/archiver/structs/published.d.ts.map +1 -0
  42. package/dest/archiver/structs/published.js +2 -0
  43. package/dest/index.d.ts.map +1 -1
  44. package/dest/index.js +3 -2
  45. package/package.json +10 -10
  46. package/src/archiver/archiver.ts +115 -53
  47. package/src/archiver/archiver_store.ts +7 -4
  48. package/src/archiver/archiver_store_test_suite.ts +66 -54
  49. package/src/archiver/data_retrieval.ts +13 -25
  50. package/src/archiver/eth_log_handlers.ts +32 -19
  51. package/src/archiver/index.ts +1 -0
  52. package/src/archiver/instrumentation.ts +39 -1
  53. package/src/archiver/kv_archiver_store/block_body_store.ts +1 -1
  54. package/src/archiver/kv_archiver_store/block_store.ts +24 -33
  55. package/src/archiver/kv_archiver_store/kv_archiver_store.ts +12 -7
  56. package/src/archiver/kv_archiver_store/message_store.ts +1 -1
  57. package/src/archiver/kv_archiver_store/proven_store.ts +34 -0
  58. package/src/archiver/memory_archiver_store/memory_archiver_store.ts +24 -15
  59. package/src/archiver/structs/data_retrieval.ts +27 -0
  60. package/src/archiver/structs/published.ts +11 -0
  61. package/src/index.ts +2 -1
@@ -3,7 +3,7 @@ import { AppendOnlyTreeSnapshot, type AztecAddress, Header, INITIAL_L2_BLOCK_NUM
3
3
  import { createDebugLogger } from '@aztec/foundation/log';
4
4
  import { type AztecKVStore, type AztecMap, type AztecSingleton, type Range } from '@aztec/kv-store';
5
5
 
6
- import { type DataRetrieval } from '../data_retrieval.js';
6
+ import { type L1Published, type L1PublishedData } from '../structs/published.js';
7
7
  import { type BlockBodyStore } from './block_body_store.js';
8
8
 
9
9
  type BlockIndexValue = [blockNumber: number, index: number];
@@ -11,6 +11,7 @@ type BlockIndexValue = [blockNumber: number, index: number];
11
11
  type BlockStorage = {
12
12
  header: Buffer;
13
13
  archive: Buffer;
14
+ l1: L1PublishedData;
14
15
  };
15
16
 
16
17
  /**
@@ -22,9 +23,6 @@ export class BlockStore {
22
23
  /** Stores L1 block number in which the last processed L2 block was included */
23
24
  #lastSynchedL1Block: AztecSingleton<bigint>;
24
25
 
25
- /** Stores last proven L2 block number */
26
- #lastProvenL2Block: AztecSingleton<number>;
27
-
28
26
  /** Index mapping transaction hash (as a string) to its location in a block */
29
27
  #txIndex: AztecMap<string, BlockIndexValue>;
30
28
 
@@ -42,28 +40,32 @@ export class BlockStore {
42
40
  this.#txIndex = db.openMap('archiver_tx_index');
43
41
  this.#contractIndex = db.openMap('archiver_contract_index');
44
42
  this.#lastSynchedL1Block = db.openSingleton('archiver_last_synched_l1_block');
45
- this.#lastProvenL2Block = db.openSingleton('archiver_last_proven_l2_block');
46
43
  }
47
44
 
48
45
  /**
49
46
  * Append new blocks to the store's list.
50
- * @param blocks - The L2 blocks to be added to the store and the last processed L1 block.
47
+ * @param blocks - The L2 blocks to be added to the store.
51
48
  * @returns True if the operation is successful.
52
49
  */
53
- addBlocks(blocks: DataRetrieval<L2Block>): Promise<boolean> {
50
+ addBlocks(blocks: L1Published<L2Block>[]): Promise<boolean> {
51
+ if (blocks.length === 0) {
52
+ return Promise.resolve(true);
53
+ }
54
+
54
55
  return this.db.transaction(() => {
55
- for (const block of blocks.retrievedData) {
56
- void this.#blocks.set(block.number, {
57
- header: block.header.toBuffer(),
58
- archive: block.archive.toBuffer(),
56
+ for (const block of blocks) {
57
+ void this.#blocks.set(block.data.number, {
58
+ header: block.data.header.toBuffer(),
59
+ archive: block.data.archive.toBuffer(),
60
+ l1: block.l1,
59
61
  });
60
62
 
61
- block.body.txEffects.forEach((tx, i) => {
62
- void this.#txIndex.set(tx.txHash.toString(), [block.number, i]);
63
+ block.data.body.txEffects.forEach((tx, i) => {
64
+ void this.#txIndex.set(tx.txHash.toString(), [block.data.number, i]);
63
65
  });
64
66
  }
65
67
 
66
- void this.#lastSynchedL1Block.set(blocks.lastProcessedL1BlockNumber);
68
+ void this.#lastSynchedL1Block.set(blocks[blocks.length - 1].l1.blockNumber);
67
69
 
68
70
  return true;
69
71
  });
@@ -75,7 +77,7 @@ export class BlockStore {
75
77
  * @param limit - The number of blocks to return.
76
78
  * @returns The requested L2 blocks
77
79
  */
78
- *getBlocks(start: number, limit: number): IterableIterator<L2Block> {
80
+ *getBlocks(start: number, limit: number): IterableIterator<L1Published<L2Block>> {
79
81
  for (const blockStorage of this.#blocks.values(this.#computeBlockRange(start, limit))) {
80
82
  yield this.getBlockFromBlockStorage(blockStorage);
81
83
  }
@@ -86,7 +88,7 @@ export class BlockStore {
86
88
  * @param blockNumber - The number of the block to return.
87
89
  * @returns The requested L2 block.
88
90
  */
89
- getBlock(blockNumber: number): L2Block | undefined {
91
+ getBlock(blockNumber: number): L1Published<L2Block> | undefined {
90
92
  const blockStorage = this.#blocks.get(blockNumber);
91
93
  if (!blockStorage || !blockStorage.header) {
92
94
  return undefined;
@@ -104,11 +106,8 @@ export class BlockStore {
104
106
  throw new Error('Body is not able to be retrieved from BodyStore');
105
107
  }
106
108
 
107
- return L2Block.fromFields({
108
- header,
109
- archive,
110
- body,
111
- });
109
+ const l2Block = L2Block.fromFields({ header, archive, body });
110
+ return { data: l2Block, l1: blockStorage.l1 };
112
111
  }
113
112
 
114
113
  /**
@@ -123,7 +122,7 @@ export class BlockStore {
123
122
  }
124
123
 
125
124
  const block = this.getBlock(blockNumber);
126
- return block?.body.txEffects[txIndex];
125
+ return block?.data.body.txEffects[txIndex];
127
126
  }
128
127
 
129
128
  /**
@@ -138,15 +137,15 @@ export class BlockStore {
138
137
  }
139
138
 
140
139
  const block = this.getBlock(blockNumber)!;
141
- const tx = block.body.txEffects[txIndex];
140
+ const tx = block.data.body.txEffects[txIndex];
142
141
 
143
142
  return new TxReceipt(
144
143
  txHash,
145
144
  TxReceipt.statusFromRevertCode(tx.revertCode),
146
145
  '',
147
146
  tx.transactionFee.toBigInt(),
148
- block.hash().toBuffer(),
149
- block.number,
147
+ block.data.hash().toBuffer(),
148
+ block.data.number,
150
149
  );
151
150
  }
152
151
 
@@ -185,14 +184,6 @@ export class BlockStore {
185
184
  return this.#lastSynchedL1Block.get() ?? 0n;
186
185
  }
187
186
 
188
- getProvenL2BlockNumber(): number {
189
- return this.#lastProvenL2Block.get() ?? 0;
190
- }
191
-
192
- async setProvenL2BlockNumber(blockNumber: number) {
193
- await this.#lastProvenL2Block.set(blockNumber);
194
- }
195
-
196
187
  #computeBlockRange(start: number, limit: number): Required<Pick<Range<number>, 'start' | 'end'>> {
197
188
  if (limit < 1) {
198
189
  throw new Error(`Invalid limit: ${limit}`);
@@ -27,7 +27,8 @@ import {
27
27
  } from '@aztec/types/contracts';
28
28
 
29
29
  import { type ArchiverDataStore, type ArchiverL1SynchPoint } from '../archiver_store.js';
30
- import { type DataRetrieval } from '../data_retrieval.js';
30
+ import { type DataRetrieval, type SingletonDataRetrieval } from '../structs/data_retrieval.js';
31
+ import { type L1Published } from '../structs/published.js';
31
32
  import { BlockBodyStore } from './block_body_store.js';
32
33
  import { BlockStore } from './block_store.js';
33
34
  import { ContractArtifactsStore } from './contract_artifacts_store.js';
@@ -35,13 +36,15 @@ import { ContractClassStore } from './contract_class_store.js';
35
36
  import { ContractInstanceStore } from './contract_instance_store.js';
36
37
  import { LogStore } from './log_store.js';
37
38
  import { MessageStore } from './message_store.js';
39
+ import { ProvenStore } from './proven_store.js';
38
40
 
39
41
  /**
40
42
  * LMDB implementation of the ArchiverDataStore interface.
41
43
  */
42
44
  export class KVArchiverDataStore implements ArchiverDataStore {
43
- #blockStore: BlockStore;
44
45
  #blockBodyStore: BlockBodyStore;
46
+ #blockStore: BlockStore;
47
+ #provenStore: ProvenStore;
45
48
  #logStore: LogStore;
46
49
  #messageStore: MessageStore;
47
50
  #contractClassStore: ContractClassStore;
@@ -53,6 +56,7 @@ export class KVArchiverDataStore implements ArchiverDataStore {
53
56
  constructor(db: AztecKVStore, logsMaxPageSize: number = 1000) {
54
57
  this.#blockBodyStore = new BlockBodyStore(db);
55
58
  this.#blockStore = new BlockStore(db, this.#blockBodyStore);
59
+ this.#provenStore = new ProvenStore(db);
56
60
  this.#logStore = new LogStore(db, this.#blockStore, logsMaxPageSize);
57
61
  this.#messageStore = new MessageStore(db);
58
62
  this.#contractClassStore = new ContractClassStore(db);
@@ -120,7 +124,7 @@ export class KVArchiverDataStore implements ArchiverDataStore {
120
124
  * @param blocks - The L2 blocks to be added to the store and the last processed L1 block.
121
125
  * @returns True if the operation is successful.
122
126
  */
123
- addBlocks(blocks: DataRetrieval<L2Block>): Promise<boolean> {
127
+ addBlocks(blocks: L1Published<L2Block>[]): Promise<boolean> {
124
128
  return this.#blockStore.addBlocks(blocks);
125
129
  }
126
130
 
@@ -131,7 +135,7 @@ export class KVArchiverDataStore implements ArchiverDataStore {
131
135
  * @param limit - The number of blocks to return.
132
136
  * @returns The requested L2 blocks
133
137
  */
134
- getBlocks(start: number, limit: number): Promise<L2Block[]> {
138
+ getBlocks(start: number, limit: number): Promise<L1Published<L2Block>[]> {
135
139
  try {
136
140
  return Promise.resolve(Array.from(this.#blockStore.getBlocks(start, limit)));
137
141
  } catch (err) {
@@ -247,11 +251,11 @@ export class KVArchiverDataStore implements ArchiverDataStore {
247
251
  }
248
252
 
249
253
  getProvenL2BlockNumber(): Promise<number> {
250
- return Promise.resolve(this.#blockStore.getProvenL2BlockNumber());
254
+ return Promise.resolve(this.#provenStore.getProvenL2BlockNumber());
251
255
  }
252
256
 
253
- async setProvenL2BlockNumber(blockNumber: number) {
254
- await this.#blockStore.setProvenL2BlockNumber(blockNumber);
257
+ async setProvenL2BlockNumber(blockNumber: SingletonDataRetrieval<number>) {
258
+ await this.#provenStore.setProvenL2BlockNumber(blockNumber);
255
259
  }
256
260
 
257
261
  /**
@@ -262,6 +266,7 @@ export class KVArchiverDataStore implements ArchiverDataStore {
262
266
  blocksSynchedTo: this.#blockStore.getSynchedL1BlockNumber(),
263
267
  blockBodiesSynchedTo: this.#blockBodyStore.getSynchedL1BlockNumber(),
264
268
  messagesSynchedTo: this.#messageStore.getSynchedL1BlockNumber(),
269
+ provenLogsSynchedTo: this.#provenStore.getSynchedL1BlockNumber(),
265
270
  });
266
271
  }
267
272
  }
@@ -8,7 +8,7 @@ import {
8
8
  import { createDebugLogger } from '@aztec/foundation/log';
9
9
  import { type AztecKVStore, type AztecMap, type AztecSingleton } from '@aztec/kv-store';
10
10
 
11
- import { type DataRetrieval } from '../data_retrieval.js';
11
+ import { type DataRetrieval } from '../structs/data_retrieval.js';
12
12
 
13
13
  /**
14
14
  * LMDB implementation of the ArchiverDataStore interface.
@@ -0,0 +1,34 @@
1
+ import { type AztecKVStore, type AztecSingleton } from '@aztec/kv-store';
2
+
3
+ import { type SingletonDataRetrieval } from '../structs/data_retrieval.js';
4
+
5
+ export class ProvenStore {
6
+ /** Stores L1 block number in which the last processed L2 block was included */
7
+ #lastSynchedL1Block: AztecSingleton<bigint>;
8
+
9
+ /** Stores last proven L2 block number */
10
+ #lastProvenL2Block: AztecSingleton<number>;
11
+
12
+ constructor(private db: AztecKVStore) {
13
+ this.#lastSynchedL1Block = db.openSingleton('archiver_last_l1_block_proven_logs');
14
+ this.#lastProvenL2Block = db.openSingleton('archiver_last_proven_l2_block');
15
+ }
16
+
17
+ /**
18
+ * Gets the most recent L1 block processed.
19
+ */
20
+ getSynchedL1BlockNumber(): bigint {
21
+ return this.#lastSynchedL1Block.get() ?? 0n;
22
+ }
23
+
24
+ getProvenL2BlockNumber(): number {
25
+ return this.#lastProvenL2Block.get() ?? 0;
26
+ }
27
+
28
+ async setProvenL2BlockNumber(blockNumber: SingletonDataRetrieval<number>) {
29
+ await this.db.transaction(() => {
30
+ void this.#lastProvenL2Block.set(blockNumber.retrievedData);
31
+ void this.#lastSynchedL1Block.set(blockNumber.lastProcessedL1BlockNumber);
32
+ });
33
+ }
34
+ }
@@ -27,7 +27,8 @@ import {
27
27
  } from '@aztec/types/contracts';
28
28
 
29
29
  import { type ArchiverDataStore, type ArchiverL1SynchPoint } from '../archiver_store.js';
30
- import { type DataRetrieval } from '../data_retrieval.js';
30
+ import { type DataRetrieval, type SingletonDataRetrieval } from '../structs/data_retrieval.js';
31
+ import { type L1Published } from '../structs/published.js';
31
32
  import { L1ToL2MessageStore } from './l1_to_l2_message_store.js';
32
33
 
33
34
  /**
@@ -37,7 +38,7 @@ export class MemoryArchiverStore implements ArchiverDataStore {
37
38
  /**
38
39
  * An array containing all the L2 blocks that have been fetched so far.
39
40
  */
40
- private l2Blocks: L2Block[] = [];
41
+ private l2Blocks: L1Published<L2Block>[] = [];
41
42
 
42
43
  /**
43
44
  * A mapping of body hash to body
@@ -85,6 +86,8 @@ export class MemoryArchiverStore implements ArchiverDataStore {
85
86
  private lastL1BlockNewBlocks: bigint = 0n;
86
87
  private lastL1BlockNewBlockBodies: bigint = 0n;
87
88
  private lastL1BlockNewMessages: bigint = 0n;
89
+ private lastL1BlockNewProvenLogs: bigint = 0n;
90
+
88
91
  private lastProvenL2BlockNumber: number = 0;
89
92
 
90
93
  constructor(
@@ -152,10 +155,14 @@ export class MemoryArchiverStore implements ArchiverDataStore {
152
155
  * @param blocks - The L2 blocks to be added to the store and the last processed L1 block.
153
156
  * @returns True if the operation is successful.
154
157
  */
155
- public addBlocks(blocks: DataRetrieval<L2Block>): Promise<boolean> {
156
- this.lastL1BlockNewBlocks = blocks.lastProcessedL1BlockNumber;
157
- this.l2Blocks.push(...blocks.retrievedData);
158
- this.txEffects.push(...blocks.retrievedData.flatMap(b => b.body.txEffects));
158
+ public addBlocks(blocks: L1Published<L2Block>[]): Promise<boolean> {
159
+ if (blocks.length === 0) {
160
+ return Promise.resolve(true);
161
+ }
162
+
163
+ this.lastL1BlockNewBlocks = blocks[blocks.length - 1].l1.blockNumber;
164
+ this.l2Blocks.push(...blocks);
165
+ this.txEffects.push(...blocks.flatMap(b => b.data.body.txEffects));
159
166
  return Promise.resolve(true);
160
167
  }
161
168
 
@@ -246,7 +253,7 @@ export class MemoryArchiverStore implements ArchiverDataStore {
246
253
  * @returns The requested L2 blocks.
247
254
  * @remarks When "from" is smaller than genesis block number, blocks from the beginning are returned.
248
255
  */
249
- public getBlocks(from: number, limit: number): Promise<L2Block[]> {
256
+ public getBlocks(from: number, limit: number): Promise<L1Published<L2Block>[]> {
250
257
  // Return an empty array if we are outside of range
251
258
  if (limit < 1) {
252
259
  return Promise.reject(new Error(`Invalid limit: ${limit}`));
@@ -278,7 +285,7 @@ export class MemoryArchiverStore implements ArchiverDataStore {
278
285
  */
279
286
  public getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined> {
280
287
  for (const block of this.l2Blocks) {
281
- for (const txEffect of block.body.txEffects) {
288
+ for (const txEffect of block.data.body.txEffects) {
282
289
  if (txEffect.txHash.equals(txHash)) {
283
290
  return Promise.resolve(
284
291
  new TxReceipt(
@@ -286,8 +293,8 @@ export class MemoryArchiverStore implements ArchiverDataStore {
286
293
  TxReceipt.statusFromRevertCode(txEffect.revertCode),
287
294
  '',
288
295
  txEffect.transactionFee.toBigInt(),
289
- block.hash().toBuffer(),
290
- block.number,
296
+ block.data.hash().toBuffer(),
297
+ block.data.number,
291
298
  ),
292
299
  );
293
300
  }
@@ -397,10 +404,10 @@ export class MemoryArchiverStore implements ArchiverDataStore {
397
404
  for (; logIndexInTx < txLogs.length; logIndexInTx++) {
398
405
  const log = txLogs[logIndexInTx];
399
406
  if (
400
- (!txHash || block.body.txEffects[txIndexInBlock].txHash.equals(txHash)) &&
407
+ (!txHash || block.data.body.txEffects[txIndexInBlock].txHash.equals(txHash)) &&
401
408
  (!contractAddress || log.contractAddress.equals(contractAddress))
402
409
  ) {
403
- logs.push(new ExtendedUnencryptedL2Log(new LogId(block.number, txIndexInBlock, logIndexInTx), log));
410
+ logs.push(new ExtendedUnencryptedL2Log(new LogId(block.data.number, txIndexInBlock, logIndexInTx), log));
404
411
  if (logs.length === this.maxLogs) {
405
412
  return Promise.resolve({
406
413
  logs,
@@ -428,15 +435,16 @@ export class MemoryArchiverStore implements ArchiverDataStore {
428
435
  if (this.l2Blocks.length === 0) {
429
436
  return Promise.resolve(INITIAL_L2_BLOCK_NUM - 1);
430
437
  }
431
- return Promise.resolve(this.l2Blocks[this.l2Blocks.length - 1].number);
438
+ return Promise.resolve(this.l2Blocks[this.l2Blocks.length - 1].data.number);
432
439
  }
433
440
 
434
441
  public getProvenL2BlockNumber(): Promise<number> {
435
442
  return Promise.resolve(this.lastProvenL2BlockNumber);
436
443
  }
437
444
 
438
- public setProvenL2BlockNumber(l2BlockNumber: number): Promise<void> {
439
- this.lastProvenL2BlockNumber = l2BlockNumber;
445
+ public setProvenL2BlockNumber(l2BlockNumber: SingletonDataRetrieval<number>): Promise<void> {
446
+ this.lastProvenL2BlockNumber = l2BlockNumber.retrievedData;
447
+ this.lastL1BlockNewProvenLogs = l2BlockNumber.lastProcessedL1BlockNumber;
440
448
  return Promise.resolve();
441
449
  }
442
450
 
@@ -445,6 +453,7 @@ export class MemoryArchiverStore implements ArchiverDataStore {
445
453
  blocksSynchedTo: this.lastL1BlockNewBlocks,
446
454
  messagesSynchedTo: this.lastL1BlockNewMessages,
447
455
  blockBodiesSynchedTo: this.lastL1BlockNewBlockBodies,
456
+ provenLogsSynchedTo: this.lastL1BlockNewProvenLogs,
448
457
  });
449
458
  }
450
459
 
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Data retrieved from logs
3
+ */
4
+ export type DataRetrieval<T> = {
5
+ /**
6
+ * Blocknumber of the last L1 block from which we obtained data.
7
+ */
8
+ lastProcessedL1BlockNumber: bigint;
9
+ /**
10
+ * The data returned.
11
+ */
12
+ retrievedData: T[];
13
+ };
14
+
15
+ /**
16
+ * Data retrieved from logs
17
+ */
18
+ export type SingletonDataRetrieval<T> = {
19
+ /**
20
+ * Blocknumber of the last L1 block from which we obtained data.
21
+ */
22
+ lastProcessedL1BlockNumber: bigint;
23
+ /**
24
+ * The data returned.
25
+ */
26
+ retrievedData: T;
27
+ };
@@ -0,0 +1,11 @@
1
+ /** Extends a type with L1 published info (block number, hash, and timestamp) */
2
+ export type L1Published<T> = {
3
+ data: T;
4
+ l1: L1PublishedData;
5
+ };
6
+
7
+ export type L1PublishedData = {
8
+ blockNumber: bigint;
9
+ timestamp: bigint;
10
+ blockHash: string;
11
+ };
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ import { createPublicClient, http } from 'viem';
6
6
  import { localhost } from 'viem/chains';
7
7
 
8
8
  import { Archiver, getArchiverConfigFromEnv } from './archiver/index.js';
9
+ import { ArchiverInstrumentation } from './archiver/instrumentation.js';
9
10
  import { MemoryArchiverStore } from './archiver/memory_archiver_store/memory_archiver_store.js';
10
11
 
11
12
  export * from './archiver/index.js';
@@ -40,7 +41,7 @@ async function main() {
40
41
  l1Contracts.registryAddress,
41
42
  archiverStore,
42
43
  1000,
43
- new NoopTelemetryClient(),
44
+ new ArchiverInstrumentation(new NoopTelemetryClient()),
44
45
  );
45
46
 
46
47
  const shutdown = async () => {