@aztec/archiver 0.0.0-test.1 → 0.0.1-commit.1142ef1

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 (151) hide show
  1. package/README.md +27 -6
  2. package/dest/archiver/archiver.d.ts +204 -94
  3. package/dest/archiver/archiver.d.ts.map +1 -1
  4. package/dest/archiver/archiver.js +1616 -414
  5. package/dest/archiver/archiver_store.d.ts +178 -83
  6. package/dest/archiver/archiver_store.d.ts.map +1 -1
  7. package/dest/archiver/archiver_store_test_suite.d.ts +1 -1
  8. package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -1
  9. package/dest/archiver/archiver_store_test_suite.js +2373 -397
  10. package/dest/archiver/config.d.ts +7 -22
  11. package/dest/archiver/config.d.ts.map +1 -1
  12. package/dest/archiver/config.js +30 -14
  13. package/dest/archiver/errors.d.ts +33 -1
  14. package/dest/archiver/errors.d.ts.map +1 -1
  15. package/dest/archiver/errors.js +49 -0
  16. package/dest/archiver/index.d.ts +3 -4
  17. package/dest/archiver/index.d.ts.map +1 -1
  18. package/dest/archiver/index.js +1 -2
  19. package/dest/archiver/instrumentation.d.ts +14 -6
  20. package/dest/archiver/instrumentation.d.ts.map +1 -1
  21. package/dest/archiver/instrumentation.js +45 -41
  22. package/dest/archiver/kv_archiver_store/block_store.d.ts +98 -21
  23. package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
  24. package/dest/archiver/kv_archiver_store/block_store.js +495 -86
  25. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +4 -4
  26. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts.map +1 -1
  27. package/dest/archiver/kv_archiver_store/contract_class_store.js +13 -19
  28. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +12 -9
  29. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts.map +1 -1
  30. package/dest/archiver/kv_archiver_store/contract_instance_store.js +30 -16
  31. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +81 -75
  32. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
  33. package/dest/archiver/kv_archiver_store/kv_archiver_store.js +145 -83
  34. package/dest/archiver/kv_archiver_store/log_store.d.ts +12 -16
  35. package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
  36. package/dest/archiver/kv_archiver_store/log_store.js +151 -114
  37. package/dest/archiver/kv_archiver_store/message_store.d.ts +25 -18
  38. package/dest/archiver/kv_archiver_store/message_store.d.ts.map +1 -1
  39. package/dest/archiver/kv_archiver_store/message_store.js +152 -49
  40. package/dest/archiver/l1/bin/retrieve-calldata.d.ts +3 -0
  41. package/dest/archiver/l1/bin/retrieve-calldata.d.ts.map +1 -0
  42. package/dest/archiver/l1/bin/retrieve-calldata.js +149 -0
  43. package/dest/archiver/l1/calldata_retriever.d.ts +112 -0
  44. package/dest/archiver/l1/calldata_retriever.d.ts.map +1 -0
  45. package/dest/archiver/l1/calldata_retriever.js +471 -0
  46. package/dest/archiver/l1/data_retrieval.d.ts +90 -0
  47. package/dest/archiver/l1/data_retrieval.d.ts.map +1 -0
  48. package/dest/archiver/l1/data_retrieval.js +331 -0
  49. package/dest/archiver/l1/debug_tx.d.ts +19 -0
  50. package/dest/archiver/l1/debug_tx.d.ts.map +1 -0
  51. package/dest/archiver/l1/debug_tx.js +73 -0
  52. package/dest/archiver/l1/spire_proposer.d.ts +70 -0
  53. package/dest/archiver/l1/spire_proposer.d.ts.map +1 -0
  54. package/dest/archiver/l1/spire_proposer.js +157 -0
  55. package/dest/archiver/l1/trace_tx.d.ts +97 -0
  56. package/dest/archiver/l1/trace_tx.d.ts.map +1 -0
  57. package/dest/archiver/l1/trace_tx.js +91 -0
  58. package/dest/archiver/l1/types.d.ts +12 -0
  59. package/dest/archiver/l1/types.d.ts.map +1 -0
  60. package/dest/archiver/l1/types.js +3 -0
  61. package/dest/archiver/l1/validate_trace.d.ts +29 -0
  62. package/dest/archiver/l1/validate_trace.d.ts.map +1 -0
  63. package/dest/archiver/l1/validate_trace.js +150 -0
  64. package/dest/archiver/structs/data_retrieval.d.ts +1 -1
  65. package/dest/archiver/structs/inbox_message.d.ts +15 -0
  66. package/dest/archiver/structs/inbox_message.d.ts.map +1 -0
  67. package/dest/archiver/structs/inbox_message.js +39 -0
  68. package/dest/archiver/structs/published.d.ts +2 -11
  69. package/dest/archiver/structs/published.d.ts.map +1 -1
  70. package/dest/archiver/structs/published.js +1 -1
  71. package/dest/archiver/validation.d.ts +17 -0
  72. package/dest/archiver/validation.d.ts.map +1 -0
  73. package/dest/archiver/validation.js +98 -0
  74. package/dest/factory.d.ts +9 -14
  75. package/dest/factory.d.ts.map +1 -1
  76. package/dest/factory.js +22 -52
  77. package/dest/index.d.ts +2 -2
  78. package/dest/index.d.ts.map +1 -1
  79. package/dest/index.js +1 -1
  80. package/dest/rpc/index.d.ts +2 -3
  81. package/dest/rpc/index.d.ts.map +1 -1
  82. package/dest/rpc/index.js +1 -4
  83. package/dest/test/index.d.ts +1 -1
  84. package/dest/test/mock_archiver.d.ts +16 -8
  85. package/dest/test/mock_archiver.d.ts.map +1 -1
  86. package/dest/test/mock_archiver.js +19 -14
  87. package/dest/test/mock_l1_to_l2_message_source.d.ts +9 -6
  88. package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
  89. package/dest/test/mock_l1_to_l2_message_source.js +30 -7
  90. package/dest/test/mock_l2_block_source.d.ts +56 -13
  91. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  92. package/dest/test/mock_l2_block_source.js +196 -25
  93. package/dest/test/mock_structs.d.ts +10 -0
  94. package/dest/test/mock_structs.d.ts.map +1 -0
  95. package/dest/test/mock_structs.js +38 -0
  96. package/package.json +29 -30
  97. package/src/archiver/archiver.ts +1596 -512
  98. package/src/archiver/archiver_store.ts +205 -88
  99. package/src/archiver/archiver_store_test_suite.ts +2386 -354
  100. package/src/archiver/config.ts +38 -46
  101. package/src/archiver/errors.ts +85 -0
  102. package/src/archiver/index.ts +2 -3
  103. package/src/archiver/instrumentation.ts +65 -45
  104. package/src/archiver/kv_archiver_store/block_store.ts +668 -101
  105. package/src/archiver/kv_archiver_store/contract_class_store.ts +14 -24
  106. package/src/archiver/kv_archiver_store/contract_instance_store.ts +36 -28
  107. package/src/archiver/kv_archiver_store/kv_archiver_store.ts +197 -113
  108. package/src/archiver/kv_archiver_store/log_store.ts +204 -132
  109. package/src/archiver/kv_archiver_store/message_store.ts +213 -54
  110. package/src/archiver/l1/README.md +98 -0
  111. package/src/archiver/l1/bin/retrieve-calldata.ts +182 -0
  112. package/src/archiver/l1/calldata_retriever.ts +641 -0
  113. package/src/archiver/l1/data_retrieval.ts +512 -0
  114. package/src/archiver/l1/debug_tx.ts +99 -0
  115. package/src/archiver/l1/spire_proposer.ts +160 -0
  116. package/src/archiver/l1/trace_tx.ts +128 -0
  117. package/src/archiver/l1/types.ts +13 -0
  118. package/src/archiver/l1/validate_trace.ts +211 -0
  119. package/src/archiver/structs/inbox_message.ts +41 -0
  120. package/src/archiver/structs/published.ts +1 -11
  121. package/src/archiver/validation.ts +124 -0
  122. package/src/factory.ts +28 -69
  123. package/src/index.ts +1 -1
  124. package/src/rpc/index.ts +1 -5
  125. package/src/test/fixtures/debug_traceTransaction-multicall3.json +88 -0
  126. package/src/test/fixtures/debug_traceTransaction-multiplePropose.json +153 -0
  127. package/src/test/fixtures/debug_traceTransaction-proxied.json +122 -0
  128. package/src/test/fixtures/trace_transaction-multicall3.json +65 -0
  129. package/src/test/fixtures/trace_transaction-multiplePropose.json +319 -0
  130. package/src/test/fixtures/trace_transaction-proxied.json +128 -0
  131. package/src/test/fixtures/trace_transaction-randomRevert.json +216 -0
  132. package/src/test/mock_archiver.ts +22 -16
  133. package/src/test/mock_l1_to_l2_message_source.ts +26 -8
  134. package/src/test/mock_l2_block_source.ts +254 -31
  135. package/src/test/mock_structs.ts +50 -0
  136. package/dest/archiver/data_retrieval.d.ts +0 -74
  137. package/dest/archiver/data_retrieval.d.ts.map +0 -1
  138. package/dest/archiver/data_retrieval.js +0 -283
  139. package/dest/archiver/kv_archiver_store/nullifier_store.d.ts +0 -12
  140. package/dest/archiver/kv_archiver_store/nullifier_store.d.ts.map +0 -1
  141. package/dest/archiver/kv_archiver_store/nullifier_store.js +0 -73
  142. package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts +0 -23
  143. package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts.map +0 -1
  144. package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.js +0 -49
  145. package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts +0 -175
  146. package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts.map +0 -1
  147. package/dest/archiver/memory_archiver_store/memory_archiver_store.js +0 -636
  148. package/src/archiver/data_retrieval.ts +0 -422
  149. package/src/archiver/kv_archiver_store/nullifier_store.ts +0 -97
  150. package/src/archiver/memory_archiver_store/l1_to_l2_message_store.ts +0 -61
  151. package/src/archiver/memory_archiver_store/memory_archiver_store.ts +0 -801
@@ -1,32 +1,34 @@
1
- import type { Fr } from '@aztec/foundation/fields';
1
+ import type { L1BlockId } from '@aztec/ethereum/l1-types';
2
+ import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3
+ import type { Fr } from '@aztec/foundation/curves/bn254';
4
+ import type { CustomRange } from '@aztec/kv-store';
2
5
  import type { FunctionSelector } from '@aztec/stdlib/abi';
3
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
- import type { InBlock, L2Block } from '@aztec/stdlib/block';
7
+ import type { CheckpointedL2Block, L2BlockNew, ValidateCheckpointResult } from '@aztec/stdlib/block';
8
+ import type { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
5
9
  import type {
6
10
  ContractClassPublic,
7
11
  ContractInstanceUpdateWithAddress,
8
12
  ContractInstanceWithAddress,
9
13
  ExecutablePrivateFunctionWithMembershipProof,
10
- UnconstrainedFunctionWithMembershipProof,
14
+ UtilityFunctionWithMembershipProof,
11
15
  } from '@aztec/stdlib/contract';
12
16
  import type { GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
13
- import type { LogFilter, PrivateLog, TxScopedL2Log } from '@aztec/stdlib/logs';
14
- import type { InboxLeaf } from '@aztec/stdlib/messaging';
15
- import { BlockHeader, type TxEffect, type TxHash, type TxReceipt } from '@aztec/stdlib/tx';
17
+ import type { LogFilter, SiloedTag, Tag, TxScopedL2Log } from '@aztec/stdlib/logs';
18
+ import { BlockHeader, type IndexedTxEffect, type TxHash, type TxReceipt } from '@aztec/stdlib/tx';
19
+ import type { UInt64 } from '@aztec/stdlib/types';
16
20
 
17
- import type { DataRetrieval } from './structs/data_retrieval.js';
18
- import type { L1Published } from './structs/published.js';
21
+ import type { CheckpointData } from './kv_archiver_store/block_store.js';
22
+ import type { InboxMessage } from './structs/inbox_message.js';
19
23
 
20
24
  /**
21
25
  * Represents the latest L1 block processed by the archiver for various objects in L2.
22
26
  */
23
27
  export type ArchiverL1SynchPoint = {
24
- /** Number of the last L1 block that added a new L2 block metadata. */
28
+ /** Number of the last L1 block that added a new L2 checkpoint metadata. */
25
29
  blocksSynchedTo?: bigint;
26
- /** Number of the last L1 block that added L1 -> L2 messages from the Inbox. */
27
- messagesSynchedTo?: bigint;
28
- /** Number of the last L1 block that added a new proven block. */
29
- provenLogsSynchedTo?: bigint;
30
+ /** Last L1 block checked for L1 to L2 messages. */
31
+ messagesSynchedTo?: L1BlockId;
30
32
  };
31
33
 
32
34
  /**
@@ -34,29 +36,113 @@ export type ArchiverL1SynchPoint = {
34
36
  * (blocks, encrypted logs, aztec contract data extended contract data).
35
37
  */
36
38
  export interface ArchiverDataStore {
39
+ /** Opens a new transaction to the underlying store and runs all operations within it. */
40
+ transactionAsync<T>(callback: () => Promise<T>): Promise<T>;
41
+
37
42
  /**
38
43
  * Append new blocks to the store's list.
39
44
  * @param blocks - The L2 blocks to be added to the store and the last processed L1 block.
45
+ * @param opts - Options for the operation.
46
+ * @param opts.force - If true, the blocks will be added even if they have gaps.
40
47
  * @returns True if the operation is successful.
41
48
  */
42
- addBlocks(blocks: L1Published<L2Block>[]): Promise<boolean>;
49
+ addBlocks(blocks: L2BlockNew[], opts?: { force?: boolean }): Promise<boolean>;
50
+
51
+ /**
52
+ * Appends new checkpoints, and their blocks to the store's collection
53
+ * @param checkpoints The collectionn of checkpoints to be added
54
+ * @returns True if the operation is successful
55
+ */
56
+ addCheckpoints(checkpoints: PublishedCheckpoint[]): Promise<boolean>;
43
57
 
44
58
  /**
45
- * Unwinds blocks from the database
59
+ * Retrieves all blocks for the requested chackpoint
60
+ * @param checkpointNumber Retreieves all blocks for the given checkpoint
61
+ * @returns The collection of blocks for the requested checkpoint if available (undefined otherwise)
62
+ */
63
+ getBlocksForCheckpoint(checkpointNumber: CheckpointNumber): Promise<L2BlockNew[] | undefined>;
64
+
65
+ /**
66
+ * Returns an array of checkpoint objects
67
+ * @param from The first checkpoint number to be retrieved
68
+ * @param limit The maximum number of chackpoints to retrieve
69
+ * @returns The array of requested checkpoint data objects
70
+ */
71
+ getRangeOfCheckpoints(from: CheckpointNumber, limit: number): Promise<CheckpointData[]>;
72
+
73
+ /**
74
+ * Unwinds checkpoints from the database
46
75
  * @param from - The tip of the chain, passed for verification purposes,
47
76
  * ensuring that we don't end up deleting something we did not intend
48
- * @param blocksToUnwind - The number of blocks we are to unwind
77
+ * @param checkpointsToUnwind - The number of checkpoints we are to unwind
49
78
  * @returns True if the operation is successful
50
79
  */
51
- unwindBlocks(from: number, blocksToUnwind: number): Promise<boolean>;
80
+ unwindCheckpoints(from: CheckpointNumber, checkpointsToUnwind: number): Promise<boolean>;
52
81
 
53
82
  /**
54
- * Gets up to `limit` amount of L2 blocks starting from `from`.
83
+ * Returns the block for the given number, or undefined if not exists.
84
+ * @param number - The block number to return.
85
+ */
86
+ getCheckpointedBlock(number: number): Promise<CheckpointedL2Block | undefined>;
87
+
88
+ /**
89
+ * Gets up to `limit` amount of checkpointed L2 blocks starting from `from`.
90
+ * @param from - Number of the first block to return (inclusive).
91
+ * @param limit - The number of blocks to return.
92
+ * @returns The requested checkpointed L2 blocks.
93
+ */
94
+ getCheckpointedBlocks(from: number, limit: number): Promise<CheckpointedL2Block[]>;
95
+
96
+ /**
97
+ * Returns the block for the given hash, or undefined if not exists.
98
+ * @param blockHash - The block hash to return.
99
+ */
100
+ getCheckpointedBlockByHash(blockHash: Fr): Promise<CheckpointedL2Block | undefined>;
101
+
102
+ /**
103
+ * Returns the block for the given archive root, or undefined if not exists.
104
+ * @param archive - The archive root to return.
105
+ */
106
+ getCheckpointedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined>;
107
+
108
+ /**
109
+ * Returns checkpoint data for the requested checkpoint number
110
+ * @param checkpointNumber - The checkpoint requested
111
+ * @returns The checkpoint data or undefined if not found
112
+ */
113
+ getCheckpointData(checkpointNumber: CheckpointNumber): Promise<CheckpointData | undefined>;
114
+
115
+ /**
116
+ * Returns the number of the latest block
117
+ * @returns The number of the latest block
118
+ */
119
+ getLatestBlockNumber(): Promise<BlockNumber>;
120
+
121
+ /**
122
+ * Returns the block for the given number, or undefined if not exists.
123
+ * @param number - The block number to return.
124
+ */
125
+ getBlock(number: number): Promise<L2BlockNew | undefined>;
126
+
127
+ /**
128
+ * Returns the block for the given hash, or undefined if not exists.
129
+ * @param blockHash - The block hash to return.
130
+ */
131
+ getBlockByHash(blockHash: Fr): Promise<L2BlockNew | undefined>;
132
+
133
+ /**
134
+ * Returns the block for the given archive root, or undefined if not exists.
135
+ * @param archive - The archive root to return.
136
+ */
137
+ getBlockByArchive(archive: Fr): Promise<L2BlockNew | undefined>;
138
+
139
+ /**
140
+ * Gets up to `limit` amount of published L2 blocks starting from `from`.
55
141
  * @param from - Number of the first block to return (inclusive).
56
142
  * @param limit - The number of blocks to return.
57
143
  * @returns The requested L2 blocks.
58
144
  */
59
- getBlocks(from: number, limit: number): Promise<L1Published<L2Block>[]>;
145
+ getBlocks(from: number, limit: number): Promise<L2BlockNew[]>;
60
146
 
61
147
  /**
62
148
  * Gets up to `limit` amount of L2 block headers starting from `from`.
@@ -64,14 +150,26 @@ export interface ArchiverDataStore {
64
150
  * @param limit - The number of blocks to return.
65
151
  * @returns The requested L2 block headers.
66
152
  */
67
- getBlockHeaders(from: number, limit: number): Promise<BlockHeader[]>;
153
+ getBlockHeaders(from: BlockNumber, limit: number): Promise<BlockHeader[]>;
154
+
155
+ /**
156
+ * Returns the block header for the given hash, or undefined if not exists.
157
+ * @param blockHash - The block hash to return.
158
+ */
159
+ getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined>;
160
+
161
+ /**
162
+ * Returns the block header for the given archive root, or undefined if not exists.
163
+ * @param archive - The archive root to return.
164
+ */
165
+ getBlockHeaderByArchive(archive: Fr): Promise<BlockHeader | undefined>;
68
166
 
69
167
  /**
70
168
  * Gets a tx effect.
71
- * @param txHash - The txHash of the tx corresponding to the tx effect.
72
- * @returns The requested tx effect (or undefined if not found).
169
+ * @param txHash - The hash of the tx corresponding to the tx effect.
170
+ * @returns The requested tx effect with block info (or undefined if not found).
73
171
  */
74
- getTxEffect(txHash: TxHash): Promise<InBlock<TxEffect> | undefined>;
172
+ getTxEffect(txHash: TxHash): Promise<IndexedTxEffect | undefined>;
75
173
 
76
174
  /**
77
175
  * Gets a receipt of a settled tx.
@@ -85,39 +183,22 @@ export interface ArchiverDataStore {
85
183
  * @param blocks - The blocks for which to add the logs.
86
184
  * @returns True if the operation is successful.
87
185
  */
88
- addLogs(blocks: L2Block[]): Promise<boolean>;
89
- deleteLogs(blocks: L2Block[]): Promise<boolean>;
90
-
91
- /**
92
- * Append new nullifiers to the store's list.
93
- * @param blocks - The blocks for which to add the nullifiers.
94
- * @returns True if the operation is successful.
95
- */
96
- addNullifiers(blocks: L2Block[]): Promise<boolean>;
97
- deleteNullifiers(blocks: L2Block[]): Promise<boolean>;
98
-
99
- /**
100
- * Returns the provided nullifier indexes scoped to the block
101
- * they were first included in, or undefined if they're not present in the tree
102
- * @param blockNumber Max block number to search for the nullifiers
103
- * @param nullifiers Nullifiers to get
104
- * @returns The block scoped indexes of the provided nullifiers, or undefined if the nullifier doesn't exist in the tree
105
- */
106
- findNullifiersIndexesWithBlock(blockNumber: number, nullifiers: Fr[]): Promise<(InBlock<bigint> | undefined)[]>;
186
+ addLogs(blocks: L2BlockNew[]): Promise<boolean>;
187
+ deleteLogs(blocks: L2BlockNew[]): Promise<boolean>;
107
188
 
108
189
  /**
109
190
  * Append L1 to L2 messages to the store.
110
- * @param messages - The L1 to L2 messages to be added to the store and the last processed L1 block.
191
+ * @param messages - The L1 to L2 messages to be added to the store.
111
192
  * @returns True if the operation is successful.
112
193
  */
113
- addL1ToL2Messages(messages: DataRetrieval<InboxLeaf>): Promise<boolean>;
194
+ addL1ToL2Messages(messages: InboxMessage[]): Promise<void>;
114
195
 
115
196
  /**
116
- * Gets L1 to L2 message (to be) included in a given block.
117
- * @param blockNumber - L2 block number to get messages for.
197
+ * Gets L1 to L2 message (to be) included in a given checkpoint.
198
+ * @param checkpointNumber - Checkpoint number to get messages for.
118
199
  * @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
119
200
  */
120
- getL1ToL2Messages(blockNumber: bigint): Promise<Fr[]>;
201
+ getL1ToL2Messages(checkpointNumber: CheckpointNumber): Promise<Fr[]>;
121
202
 
122
203
  /**
123
204
  * Gets the L1 to L2 message index in the L1 to L2 message tree.
@@ -133,20 +214,17 @@ export interface ArchiverDataStore {
133
214
  getTotalL1ToL2MessageCount(): Promise<bigint>;
134
215
 
135
216
  /**
136
- * Retrieves all private logs from up to `limit` blocks, starting from the block number `from`.
137
- * @param from - The block number from which to begin retrieving logs.
138
- * @param limit - The maximum number of blocks to retrieve logs from.
139
- * @returns An array of private logs from the specified range of blocks.
217
+ /**
218
+ * Gets all private logs that match any of the `tags`. For each tag, an array of matching logs is returned. An empty
219
+ * array implies no logs match that tag.
140
220
  */
141
- getPrivateLogs(from: number, limit: number): Promise<PrivateLog[]>;
221
+ getPrivateLogsByTags(tags: SiloedTag[]): Promise<TxScopedL2Log[][]>;
142
222
 
143
223
  /**
144
- * Gets all logs that match any of the received tags (i.e. logs with their first field equal to a tag).
145
- * @param tags - The tags to filter the logs by.
146
- * @returns For each received tag, an array of matching logs is returned. An empty array implies no logs match
147
- * that tag.
224
+ * Gets all public logs that match any of the `tags` from the specified contract. For each tag, an array of matching
225
+ * logs is returned. An empty array implies no logs match that tag.
148
226
  */
149
- getLogsByTags(tags: Fr[]): Promise<TxScopedL2Log[][]>;
227
+ getPublicLogsByTagsFromContract(contractAddress: AztecAddress, tags: Tag[]): Promise<TxScopedL2Log[][]>;
150
228
 
151
229
  /**
152
230
  * Gets public logs based on the provided filter.
@@ -166,31 +244,42 @@ export interface ArchiverDataStore {
166
244
  * Gets the number of the latest L2 block processed.
167
245
  * @returns The number of the latest L2 block processed.
168
246
  */
169
- getSynchedL2BlockNumber(): Promise<number>;
247
+ getCheckpointedL2BlockNumber(): Promise<BlockNumber>;
170
248
 
171
249
  /**
172
- * Gets the number of the latest proven L2 block processed.
173
- * @returns The number of the latest proven L2 block processed.
250
+ * Gets the number of the latest published checkpoint processed.
251
+ * @returns The number of the latest published checkpoint processed
174
252
  */
175
- getProvenL2BlockNumber(): Promise<number>;
253
+ getSynchedCheckpointNumber(): Promise<CheckpointNumber>;
176
254
 
177
255
  /**
178
- * Stores the number of the latest proven L2 block processed.
179
- * @param l2BlockNumber - The number of the latest proven L2 block processed.
256
+ * Gets the number of the latest proven checkpoint processed.
257
+ * @returns The number of the latest proven checkpoint processed.
180
258
  */
181
- setProvenL2BlockNumber(l2BlockNumber: number): Promise<void>;
259
+ getProvenCheckpointNumber(): Promise<CheckpointNumber>;
182
260
 
183
261
  /**
184
- * Stores the l1 block number that blocks have been synched until
185
- * @param l1BlockNumber - The l1 block number
262
+ * Returns the number of the most recent proven block
263
+ * @returns The number of the most recent proven block
186
264
  */
187
- setBlockSynchedL1BlockNumber(l1BlockNumber: bigint): Promise<void>;
265
+ getProvenBlockNumber(): Promise<BlockNumber>;
188
266
 
189
267
  /**
190
- * Stores the l1 block number that messages have been synched until
268
+ * Stores the number of the latest proven checkpoint processed.
269
+ * @param checkpointNumber - The number of the latest proven checkpoint processed.
270
+ */
271
+ setProvenCheckpointNumber(checkpointNumber: CheckpointNumber): Promise<void>;
272
+
273
+ /**
274
+ * Stores the l1 block number that checkpoints have been synched until
191
275
  * @param l1BlockNumber - The l1 block number
192
276
  */
193
- setMessageSynchedL1BlockNumber(l1BlockNumber: bigint): Promise<void>;
277
+ setCheckpointSynchedL1BlockNumber(l1BlockNumber: bigint): Promise<void>;
278
+
279
+ /**
280
+ * Stores the l1 block that messages have been synched until
281
+ */
282
+ setMessageSynchedL1Block(l1Block: L1BlockId): Promise<void>;
194
283
 
195
284
  /**
196
285
  * Gets the synch point of the archiver
@@ -203,9 +292,13 @@ export interface ArchiverDataStore {
203
292
  * @param blockNumber - Number of the L2 block the contracts were registered in.
204
293
  * @returns True if the operation is successful.
205
294
  */
206
- addContractClasses(data: ContractClassPublic[], bytecodeCommitments: Fr[], blockNumber: number): Promise<boolean>;
295
+ addContractClasses(
296
+ data: ContractClassPublic[],
297
+ bytecodeCommitments: Fr[],
298
+ blockNumber: BlockNumber,
299
+ ): Promise<boolean>;
207
300
 
208
- deleteContractClasses(data: ContractClassPublic[], blockNumber: number): Promise<boolean>;
301
+ deleteContractClasses(data: ContractClassPublic[], blockNumber: BlockNumber): Promise<boolean>;
209
302
 
210
303
  getBytecodeCommitment(contractClassId: Fr): Promise<Fr | undefined>;
211
304
 
@@ -221,43 +314,67 @@ export interface ArchiverDataStore {
221
314
  * @param blockNumber - Number of the L2 block the instances were deployed in.
222
315
  * @returns True if the operation is successful.
223
316
  */
224
- addContractInstances(data: ContractInstanceWithAddress[], blockNumber: number): Promise<boolean>;
225
- deleteContractInstances(data: ContractInstanceWithAddress[], blockNumber: number): Promise<boolean>;
317
+ addContractInstances(data: ContractInstanceWithAddress[], blockNumber: BlockNumber): Promise<boolean>;
318
+ deleteContractInstances(data: ContractInstanceWithAddress[], blockNumber: BlockNumber): Promise<boolean>;
226
319
 
227
320
  /**
228
321
  * Add new contract instance updates
229
322
  * @param data - List of contract updates to be added.
230
- * @param blockNumber - Number of the L2 block the updates were scheduled in.
323
+ * @param timestamp - Timestamp at which the updates were scheduled.
231
324
  * @returns True if the operation is successful.
232
325
  */
233
- addContractInstanceUpdates(data: ContractInstanceUpdateWithAddress[], blockNumber: number): Promise<boolean>;
234
- deleteContractInstanceUpdates(data: ContractInstanceUpdateWithAddress[], blockNumber: number): Promise<boolean>;
326
+ addContractInstanceUpdates(data: ContractInstanceUpdateWithAddress[], timestamp: UInt64): Promise<boolean>;
327
+ deleteContractInstanceUpdates(data: ContractInstanceUpdateWithAddress[], timestamp: UInt64): Promise<boolean>;
235
328
  /**
236
329
  * Adds private functions to a contract class.
237
330
  */
238
331
  addFunctions(
239
332
  contractClassId: Fr,
240
333
  privateFunctions: ExecutablePrivateFunctionWithMembershipProof[],
241
- unconstrainedFunctions: UnconstrainedFunctionWithMembershipProof[],
334
+ utilityFunctions: UtilityFunctionWithMembershipProof[],
242
335
  ): Promise<boolean>;
243
336
 
244
337
  /**
245
- * Returns a contract instance given its address and the given block number, or undefined if not exists.
338
+ * Returns a contract instance given its address and the given timestamp, or undefined if not exists.
246
339
  * @param address - Address of the contract.
340
+ * @param timestamp - Timestamp to get the contract instance at. Contract updates might change the instance.
341
+ * @returns The contract instance or undefined if not found.
247
342
  */
248
- getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
343
+ getContractInstance(address: AztecAddress, timestamp: UInt64): Promise<ContractInstanceWithAddress | undefined>;
249
344
 
250
345
  /** Returns the list of all class ids known by the archiver. */
251
346
  getContractClassIds(): Promise<Fr[]>;
252
347
 
253
- // TODO: These function names are in memory only as they are for development/debugging. They require the full contract
254
- // artifact supplied to the node out of band. This should be reviewed and potentially removed as part of
255
- // the node api cleanup process.
256
- registerContractFunctionSignatures(address: AztecAddress, signatures: string[]): Promise<void>;
257
- getContractFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
348
+ /** Register a public function signature, so it can be looked up by selector. */
349
+ registerContractFunctionSignatures(signatures: string[]): Promise<void>;
258
350
 
259
- /**
260
- * Estimates the size of the store in bytes.
261
- */
262
- estimateSize(): Promise<{ mappingSize: number; actualSize: number; numItems: number }>;
351
+ /** Looks up a public function name given a selector. */
352
+ getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
353
+
354
+ /** Estimates the size of the store in bytes. */
355
+ estimateSize(): Promise<{ mappingSize: number; physicalFileSize: number; actualSize: number; numItems: number }>;
356
+
357
+ /** Backups the archiver db to the target folder. Returns the path to the db file. */
358
+ backupTo(path: string): Promise<string>;
359
+
360
+ /** Closes the underlying data store. */
361
+ close(): Promise<void>;
362
+
363
+ /** Deletes all L1 to L2 messages up until (excluding) the target checkpoint number. */
364
+ rollbackL1ToL2MessagesToCheckpoint(targetCheckpointNumber: CheckpointNumber): Promise<void>;
365
+
366
+ /** Returns an async iterator to all L1 to L2 messages on the range. */
367
+ iterateL1ToL2Messages(range?: CustomRange<bigint>): AsyncIterableIterator<InboxMessage>;
368
+
369
+ /** Removes all L1 to L2 messages starting from the given index (inclusive). */
370
+ removeL1ToL2Messages(startIndex: bigint): Promise<void>;
371
+
372
+ /** Returns the last L1 to L2 message stored. */
373
+ getLastL1ToL2Message(): Promise<InboxMessage | undefined>;
374
+
375
+ /** Returns the last synced validation status of the pending chain. */
376
+ getPendingChainValidationStatus(): Promise<ValidateCheckpointResult | undefined>;
377
+
378
+ /** Sets the last synced validation status of the pending chain. */
379
+ setPendingChainValidationStatus(status: ValidateCheckpointResult | undefined): Promise<void>;
263
380
  }