@aztec/archiver 4.0.0-nightly.20260112 → 4.0.0-nightly.20260114
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.
- package/README.md +139 -22
- package/dest/archiver/archive_source_base.d.ts +75 -0
- package/dest/archiver/archive_source_base.d.ts.map +1 -0
- package/dest/archiver/archive_source_base.js +202 -0
- package/dest/archiver/archiver.d.ts +32 -168
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +123 -613
- package/dest/archiver/archiver_store_updates.d.ts +38 -0
- package/dest/archiver/archiver_store_updates.d.ts.map +1 -0
- package/dest/archiver/archiver_store_updates.js +212 -0
- package/dest/archiver/config.js +2 -2
- package/dest/archiver/index.d.ts +3 -2
- package/dest/archiver/index.d.ts.map +1 -1
- package/dest/archiver/index.js +2 -0
- package/dest/archiver/kv_archiver_store/block_store.d.ts +12 -5
- package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/block_store.js +23 -4
- package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +1 -1
- package/dest/archiver/kv_archiver_store/contract_class_store.js +1 -1
- package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +1 -1
- package/dest/archiver/kv_archiver_store/contract_instance_store.js +1 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +173 -12
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.js +159 -48
- package/dest/archiver/l1/calldata_retriever.d.ts +2 -2
- package/dest/archiver/l1/calldata_retriever.d.ts.map +1 -1
- package/dest/archiver/l1/calldata_retriever.js +2 -2
- package/dest/archiver/l1/data_retrieval.d.ts +9 -11
- package/dest/archiver/l1/data_retrieval.d.ts.map +1 -1
- package/dest/archiver/l1/data_retrieval.js +32 -51
- package/dest/archiver/l1/validate_trace.js +1 -1
- package/dest/archiver/test/fake_l1_state.d.ts +173 -0
- package/dest/archiver/test/fake_l1_state.d.ts.map +1 -0
- package/dest/archiver/test/fake_l1_state.js +364 -0
- package/dest/archiver/validation.d.ts +4 -4
- package/dest/archiver/validation.d.ts.map +1 -1
- package/dest/archiver/validation.js +1 -1
- package/dest/test/mock_l1_to_l2_message_source.d.ts +2 -2
- package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/test/mock_l1_to_l2_message_source.js +12 -3
- package/dest/test/mock_l2_block_source.d.ts +8 -4
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +65 -19
- package/package.json +13 -13
- package/src/archiver/archive_source_base.ts +339 -0
- package/src/archiver/archiver.ts +166 -815
- package/src/archiver/archiver_store_updates.ts +321 -0
- package/src/archiver/config.ts +2 -2
- package/src/archiver/index.ts +2 -1
- package/src/archiver/kv_archiver_store/block_store.ts +36 -8
- package/src/archiver/kv_archiver_store/contract_class_store.ts +1 -1
- package/src/archiver/kv_archiver_store/contract_instance_store.ts +1 -1
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +177 -11
- package/src/archiver/l1/calldata_retriever.ts +2 -2
- package/src/archiver/l1/data_retrieval.ts +51 -68
- package/src/archiver/l1/validate_trace.ts +1 -1
- package/src/archiver/test/fake_l1_state.ts +561 -0
- package/src/archiver/validation.ts +6 -6
- package/src/test/mock_l1_to_l2_message_source.ts +10 -4
- package/src/test/mock_l2_block_source.ts +76 -18
- package/dest/archiver/archiver_store.d.ts +0 -308
- package/dest/archiver/archiver_store.d.ts.map +0 -1
- package/dest/archiver/archiver_store.js +0 -4
- package/dest/archiver/archiver_store_test_suite.d.ts +0 -8
- package/dest/archiver/archiver_store_test_suite.d.ts.map +0 -1
- package/dest/archiver/archiver_store_test_suite.js +0 -2770
- package/src/archiver/archiver_store.ts +0 -372
- package/src/archiver/archiver_store_test_suite.ts +0 -2843
|
@@ -6,7 +6,7 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
6
6
|
import type { AztecAsyncKVStore, CustomRange, StoreSize } from '@aztec/kv-store';
|
|
7
7
|
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
8
8
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
|
-
import { CheckpointedL2Block, L2BlockHash, L2BlockNew, type
|
|
9
|
+
import { CheckpointedL2Block, L2BlockHash, L2BlockNew, type ValidateCheckpointResult } from '@aztec/stdlib/block';
|
|
10
10
|
import type { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
11
11
|
import type {
|
|
12
12
|
ContractClassPublic,
|
|
@@ -23,7 +23,6 @@ import type { UInt64 } from '@aztec/stdlib/types';
|
|
|
23
23
|
|
|
24
24
|
import { join } from 'path';
|
|
25
25
|
|
|
26
|
-
import type { ArchiverDataStore, ArchiverL1SynchPoint } from '../archiver_store.js';
|
|
27
26
|
import type { InboxMessage } from '../structs/inbox_message.js';
|
|
28
27
|
import { BlockStore, type CheckpointData } from './block_store.js';
|
|
29
28
|
import { ContractClassStore } from './contract_class_store.js';
|
|
@@ -36,9 +35,20 @@ export const MAX_FUNCTION_SIGNATURES = 1000;
|
|
|
36
35
|
export const MAX_FUNCTION_NAME_LEN = 256;
|
|
37
36
|
|
|
38
37
|
/**
|
|
39
|
-
*
|
|
38
|
+
* Represents the latest L1 block processed by the archiver for various objects in L2.
|
|
40
39
|
*/
|
|
41
|
-
export
|
|
40
|
+
export type ArchiverL1SynchPoint = {
|
|
41
|
+
/** Number of the last L1 block that added a new L2 checkpoint metadata. */
|
|
42
|
+
blocksSynchedTo?: bigint;
|
|
43
|
+
/** Last L1 block checked for L1 to L2 messages. */
|
|
44
|
+
messagesSynchedTo?: L1BlockId;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* LMDB-based data store for the archiver.
|
|
49
|
+
* Stores all archiver data including blocks, logs, contract classes/instances, and L1 to L2 messages.
|
|
50
|
+
*/
|
|
51
|
+
export class KVArchiverDataStore implements ContractDataSource {
|
|
42
52
|
public static readonly SCHEMA_VERSION = ARCHIVER_DB_VERSION;
|
|
43
53
|
|
|
44
54
|
#blockStore: BlockStore;
|
|
@@ -62,6 +72,7 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
62
72
|
this.#contractInstanceStore = new ContractInstanceStore(db);
|
|
63
73
|
}
|
|
64
74
|
|
|
75
|
+
/** Opens a new transaction to the underlying store and runs all operations within it. */
|
|
65
76
|
public transactionAsync<T>(callback: () => Promise<T>): Promise<T> {
|
|
66
77
|
return this.db.transactionAsync(callback);
|
|
67
78
|
}
|
|
@@ -79,19 +90,23 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
79
90
|
return this.getContractInstance(address, timestamp);
|
|
80
91
|
}
|
|
81
92
|
|
|
93
|
+
/** Backups the archiver db to the target folder. Returns the path to the db file. */
|
|
82
94
|
public async backupTo(path: string, compress = true): Promise<string> {
|
|
83
95
|
await this.db.backupTo(path, compress);
|
|
84
96
|
return join(path, 'data.mdb');
|
|
85
97
|
}
|
|
86
98
|
|
|
99
|
+
/** Closes the underlying data store. */
|
|
87
100
|
public close() {
|
|
88
101
|
return this.db.close();
|
|
89
102
|
}
|
|
90
103
|
|
|
104
|
+
/** Looks up a public function name given a selector. */
|
|
91
105
|
getDebugFunctionName(_address: AztecAddress, selector: FunctionSelector): Promise<string | undefined> {
|
|
92
106
|
return Promise.resolve(this.functionNames.get(selector.toString()));
|
|
93
107
|
}
|
|
94
108
|
|
|
109
|
+
/** Register a public function signature, so it can be looked up by selector. */
|
|
95
110
|
async registerContractFunctionSignatures(signatures: string[]): Promise<void> {
|
|
96
111
|
for (const sig of signatures) {
|
|
97
112
|
if (this.functionNames.size > MAX_FUNCTION_SIGNATURES) {
|
|
@@ -106,14 +121,25 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
106
121
|
}
|
|
107
122
|
}
|
|
108
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Returns a contract class given its id, or undefined if not exists.
|
|
126
|
+
* @param id - Id of the contract class.
|
|
127
|
+
*/
|
|
109
128
|
getContractClass(id: Fr): Promise<ContractClassPublic | undefined> {
|
|
110
129
|
return this.#contractClassStore.getContractClass(id);
|
|
111
130
|
}
|
|
112
131
|
|
|
132
|
+
/** Returns the list of all class ids known by the archiver. */
|
|
113
133
|
getContractClassIds(): Promise<Fr[]> {
|
|
114
134
|
return this.#contractClassStore.getContractClassIds();
|
|
115
135
|
}
|
|
116
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Returns a contract instance given its address and the given timestamp, or undefined if not exists.
|
|
139
|
+
* @param address - Address of the contract.
|
|
140
|
+
* @param timestamp - Timestamp to get the contract instance at. Contract updates might change the instance.
|
|
141
|
+
* @returns The contract instance or undefined if not found.
|
|
142
|
+
*/
|
|
117
143
|
getContractInstance(address: AztecAddress, timestamp: UInt64): Promise<ContractInstanceWithAddress | undefined> {
|
|
118
144
|
return this.#contractInstanceStore.getContractInstance(address, timestamp);
|
|
119
145
|
}
|
|
@@ -122,6 +148,13 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
122
148
|
return this.#contractInstanceStore.getContractInstanceDeploymentBlockNumber(address);
|
|
123
149
|
}
|
|
124
150
|
|
|
151
|
+
/**
|
|
152
|
+
* Add new contract classes from an L2 block to the store's list.
|
|
153
|
+
* @param data - List of contract classes to be added.
|
|
154
|
+
* @param bytecodeCommitments - Bytecode commitments for the contract classes.
|
|
155
|
+
* @param blockNumber - Number of the L2 block the contracts were registered in.
|
|
156
|
+
* @returns True if the operation is successful.
|
|
157
|
+
*/
|
|
125
158
|
async addContractClasses(
|
|
126
159
|
data: ContractClassPublic[],
|
|
127
160
|
bytecodeCommitments: Fr[],
|
|
@@ -144,6 +177,7 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
144
177
|
return this.#contractClassStore.getBytecodeCommitment(contractClassId);
|
|
145
178
|
}
|
|
146
179
|
|
|
180
|
+
/** Adds private functions to a contract class. */
|
|
147
181
|
addFunctions(
|
|
148
182
|
contractClassId: Fr,
|
|
149
183
|
privateFunctions: ExecutablePrivateFunctionWithMembershipProof[],
|
|
@@ -152,6 +186,12 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
152
186
|
return this.#contractClassStore.addFunctions(contractClassId, privateFunctions, utilityFunctions);
|
|
153
187
|
}
|
|
154
188
|
|
|
189
|
+
/**
|
|
190
|
+
* Add new contract instances from an L2 block to the store's list.
|
|
191
|
+
* @param data - List of contract instances to be added.
|
|
192
|
+
* @param blockNumber - Number of the L2 block the instances were deployed in.
|
|
193
|
+
* @returns True if the operation is successful.
|
|
194
|
+
*/
|
|
155
195
|
async addContractInstances(data: ContractInstanceWithAddress[], blockNumber: BlockNumber): Promise<boolean> {
|
|
156
196
|
return (await Promise.all(data.map(c => this.#contractInstanceStore.addContractInstance(c, blockNumber)))).every(
|
|
157
197
|
Boolean,
|
|
@@ -162,6 +202,12 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
162
202
|
return (await Promise.all(data.map(c => this.#contractInstanceStore.deleteContractInstance(c)))).every(Boolean);
|
|
163
203
|
}
|
|
164
204
|
|
|
205
|
+
/**
|
|
206
|
+
* Add new contract instance updates
|
|
207
|
+
* @param data - List of contract updates to be added.
|
|
208
|
+
* @param timestamp - Timestamp at which the updates were scheduled.
|
|
209
|
+
* @returns True if the operation is successful.
|
|
210
|
+
*/
|
|
165
211
|
async addContractInstanceUpdates(data: ContractInstanceUpdateWithAddress[], timestamp: UInt64): Promise<boolean> {
|
|
166
212
|
return (
|
|
167
213
|
await Promise.all(
|
|
@@ -190,9 +236,19 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
190
236
|
return this.#blockStore.addBlocks(blocks, opts);
|
|
191
237
|
}
|
|
192
238
|
|
|
239
|
+
/**
|
|
240
|
+
* Returns an array of checkpoint objects
|
|
241
|
+
* @param from The first checkpoint number to be retrieved
|
|
242
|
+
* @param limit The maximum number of checkpoints to retrieve
|
|
243
|
+
* @returns The array of requested checkpoint data objects
|
|
244
|
+
*/
|
|
193
245
|
getRangeOfCheckpoints(from: CheckpointNumber, limit: number): Promise<CheckpointData[]> {
|
|
194
246
|
return this.#blockStore.getRangeOfCheckpoints(from, limit);
|
|
195
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Returns the number of the latest block
|
|
250
|
+
* @returns The number of the latest block
|
|
251
|
+
*/
|
|
196
252
|
getLatestBlockNumber(): Promise<BlockNumber> {
|
|
197
253
|
return this.#blockStore.getLatestBlockNumber();
|
|
198
254
|
}
|
|
@@ -208,47 +264,100 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
208
264
|
return this.#blockStore.unwindCheckpoints(from, checkpointsToUnwind);
|
|
209
265
|
}
|
|
210
266
|
|
|
267
|
+
/**
|
|
268
|
+
* Appends new checkpoints, and their blocks to the store's collection
|
|
269
|
+
* @param checkpoints The collection of checkpoints to be added
|
|
270
|
+
* @returns True if the operation is successful
|
|
271
|
+
*/
|
|
211
272
|
addCheckpoints(checkpoints: PublishedCheckpoint[]): Promise<boolean> {
|
|
212
273
|
return this.#blockStore.addCheckpoints(checkpoints);
|
|
213
274
|
}
|
|
214
275
|
|
|
276
|
+
/**
|
|
277
|
+
* Returns the block for the given number, or undefined if not exists.
|
|
278
|
+
* @param number - The block number to return.
|
|
279
|
+
*/
|
|
215
280
|
getCheckpointedBlock(number: BlockNumber): Promise<CheckpointedL2Block | undefined> {
|
|
216
281
|
return this.#blockStore.getCheckpointedBlock(number);
|
|
217
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* Returns the block for the given hash, or undefined if not exists.
|
|
285
|
+
* @param blockHash - The block hash to return.
|
|
286
|
+
*/
|
|
218
287
|
getCheckpointedBlockByHash(blockHash: Fr): Promise<CheckpointedL2Block | undefined> {
|
|
219
288
|
return this.#blockStore.getCheckpointedBlockByHash(blockHash);
|
|
220
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Returns the block for the given archive root, or undefined if not exists.
|
|
292
|
+
* @param archive - The archive root to return.
|
|
293
|
+
*/
|
|
221
294
|
getCheckpointedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined> {
|
|
222
295
|
return this.#blockStore.getCheckpointedBlockByArchive(archive);
|
|
223
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Returns the block for the given number, or undefined if not exists.
|
|
299
|
+
* @param number - The block number to return.
|
|
300
|
+
*/
|
|
224
301
|
getBlock(number: BlockNumber): Promise<L2BlockNew | undefined> {
|
|
225
302
|
return this.#blockStore.getBlock(number);
|
|
226
303
|
}
|
|
304
|
+
/**
|
|
305
|
+
* Returns the block for the given hash, or undefined if not exists.
|
|
306
|
+
* @param blockHash - The block hash to return.
|
|
307
|
+
*/
|
|
227
308
|
getBlockByHash(blockHash: Fr): Promise<L2BlockNew | undefined> {
|
|
228
309
|
return this.#blockStore.getBlockByHash(L2BlockHash.fromField(blockHash));
|
|
229
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* Returns the block for the given archive root, or undefined if not exists.
|
|
313
|
+
* @param archive - The archive root to return.
|
|
314
|
+
*/
|
|
230
315
|
getBlockByArchive(archive: Fr): Promise<L2BlockNew | undefined> {
|
|
231
316
|
return this.#blockStore.getBlockByArchive(archive);
|
|
232
317
|
}
|
|
233
|
-
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Gets up to `limit` amount of published L2 blocks starting from `from`.
|
|
321
|
+
* @param from - Number of the first block to return (inclusive).
|
|
322
|
+
* @param limit - The number of blocks to return.
|
|
323
|
+
* @returns The requested L2 blocks.
|
|
324
|
+
*/
|
|
325
|
+
getBlocks(from: BlockNumber, limit: number): Promise<L2BlockNew[]> {
|
|
234
326
|
return toArray(this.#blockStore.getBlocks(from, limit));
|
|
235
327
|
}
|
|
236
328
|
|
|
237
329
|
/**
|
|
238
|
-
* Gets up to `limit` amount of L2 blocks
|
|
239
|
-
*
|
|
330
|
+
* Gets up to `limit` amount of checkpointed L2 blocks starting from `from`.
|
|
331
|
+
* @param from - Number of the first block to return (inclusive).
|
|
332
|
+
* @param limit - The number of blocks to return.
|
|
333
|
+
* @returns The requested checkpointed L2 blocks.
|
|
334
|
+
*/
|
|
335
|
+
getCheckpointedBlocks(from: BlockNumber, limit: number): Promise<CheckpointedL2Block[]> {
|
|
336
|
+
return toArray(this.#blockStore.getCheckpointedBlocks(from, limit));
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Gets up to `limit` amount of L2 block headers starting from `from`.
|
|
240
341
|
* @param start - Number of the first block to return (inclusive).
|
|
241
342
|
* @param limit - The number of blocks to return.
|
|
242
|
-
* @returns The requested L2
|
|
343
|
+
* @returns The requested L2 block headers.
|
|
243
344
|
*/
|
|
244
345
|
getBlockHeaders(start: BlockNumber, limit: number): Promise<BlockHeader[]> {
|
|
245
346
|
return toArray(this.#blockStore.getBlockHeaders(start, limit));
|
|
246
347
|
}
|
|
247
348
|
|
|
349
|
+
/**
|
|
350
|
+
* Returns the block header for the given hash, or undefined if not exists.
|
|
351
|
+
* @param blockHash - The block hash to return.
|
|
352
|
+
*/
|
|
248
353
|
getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined> {
|
|
249
354
|
return this.#blockStore.getBlockHeaderByHash(L2BlockHash.fromField(blockHash));
|
|
250
355
|
}
|
|
251
356
|
|
|
357
|
+
/**
|
|
358
|
+
* Returns the block header for the given archive root, or undefined if not exists.
|
|
359
|
+
* @param archive - The archive root to return.
|
|
360
|
+
*/
|
|
252
361
|
getBlockHeaderByArchive(archive: Fr): Promise<BlockHeader | undefined> {
|
|
253
362
|
return this.#blockStore.getBlockHeaderByArchive(archive);
|
|
254
363
|
}
|
|
@@ -284,10 +393,15 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
284
393
|
return this.#logStore.deleteLogs(blocks);
|
|
285
394
|
}
|
|
286
395
|
|
|
396
|
+
/**
|
|
397
|
+
* Get the total number of L1 to L2 messages
|
|
398
|
+
* @returns The number of L1 to L2 messages in the store
|
|
399
|
+
*/
|
|
287
400
|
getTotalL1ToL2MessageCount(): Promise<bigint> {
|
|
288
401
|
return this.#messageStore.getTotalL1ToL2MessageCount();
|
|
289
402
|
}
|
|
290
403
|
|
|
404
|
+
/** Returns the last L1 to L2 message stored. */
|
|
291
405
|
getLastL1ToL2Message(): Promise<InboxMessage | undefined> {
|
|
292
406
|
return this.#messageStore.getLastMessage();
|
|
293
407
|
}
|
|
@@ -295,6 +409,7 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
295
409
|
/**
|
|
296
410
|
* Append L1 to L2 messages to the store.
|
|
297
411
|
* @param messages - The L1 to L2 messages to be added to the store.
|
|
412
|
+
* @returns True if the operation is successful.
|
|
298
413
|
*/
|
|
299
414
|
addL1ToL2Messages(messages: InboxMessage[]): Promise<void> {
|
|
300
415
|
return this.#messageStore.addL1ToL2Messages(messages);
|
|
@@ -318,6 +433,10 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
318
433
|
return this.#messageStore.getL1ToL2Messages(checkpointNumber);
|
|
319
434
|
}
|
|
320
435
|
|
|
436
|
+
/**
|
|
437
|
+
* Gets all private logs that match any of the `tags`. For each tag, an array of matching logs is returned. An empty
|
|
438
|
+
* array implies no logs match that tag.
|
|
439
|
+
*/
|
|
321
440
|
getPrivateLogsByTags(tags: SiloedTag[]): Promise<TxScopedL2Log[][]> {
|
|
322
441
|
try {
|
|
323
442
|
return this.#logStore.getPrivateLogsByTags(tags);
|
|
@@ -326,6 +445,10 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
326
445
|
}
|
|
327
446
|
}
|
|
328
447
|
|
|
448
|
+
/**
|
|
449
|
+
* Gets all public logs that match any of the `tags` from the specified contract. For each tag, an array of matching
|
|
450
|
+
* logs is returned. An empty array implies no logs match that tag.
|
|
451
|
+
*/
|
|
329
452
|
getPublicLogsByTagsFromContract(contractAddress: AztecAddress, tags: Tag[]): Promise<TxScopedL2Log[][]> {
|
|
330
453
|
try {
|
|
331
454
|
return this.#logStore.getPublicLogsByTagsFromContract(contractAddress, tags);
|
|
@@ -360,10 +483,18 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
360
483
|
}
|
|
361
484
|
}
|
|
362
485
|
|
|
486
|
+
/**
|
|
487
|
+
* Gets the number of the latest proven checkpoint processed.
|
|
488
|
+
* @returns The number of the latest proven checkpoint processed.
|
|
489
|
+
*/
|
|
363
490
|
getProvenCheckpointNumber(): Promise<CheckpointNumber> {
|
|
364
491
|
return this.#blockStore.getProvenCheckpointNumber();
|
|
365
492
|
}
|
|
366
493
|
|
|
494
|
+
/**
|
|
495
|
+
* Stores the number of the latest proven checkpoint processed.
|
|
496
|
+
* @param checkpointNumber - The number of the latest proven checkpoint processed.
|
|
497
|
+
*/
|
|
367
498
|
async setProvenCheckpointNumber(checkpointNumber: CheckpointNumber) {
|
|
368
499
|
await this.#blockStore.setProvenCheckpointNumber(checkpointNumber);
|
|
369
500
|
}
|
|
@@ -372,16 +503,23 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
372
503
|
await this.#blockStore.setSynchedL1BlockNumber(l1BlockNumber);
|
|
373
504
|
}
|
|
374
505
|
|
|
506
|
+
/**
|
|
507
|
+
* Stores the l1 block that messages have been synched until
|
|
508
|
+
*/
|
|
375
509
|
async setMessageSynchedL1Block(l1Block: L1BlockId) {
|
|
376
510
|
await this.#messageStore.setSynchedL1Block(l1Block);
|
|
377
511
|
}
|
|
378
512
|
|
|
513
|
+
/**
|
|
514
|
+
* Returns the number of the most recent proven block
|
|
515
|
+
* @returns The number of the most recent proven block
|
|
516
|
+
*/
|
|
379
517
|
getProvenBlockNumber(): Promise<BlockNumber> {
|
|
380
518
|
return this.#blockStore.getProvenBlockNumber();
|
|
381
519
|
}
|
|
382
520
|
|
|
383
521
|
/**
|
|
384
|
-
* Gets the
|
|
522
|
+
* Gets the synch point of the archiver
|
|
385
523
|
*/
|
|
386
524
|
async getSynchPoint(): Promise<ArchiverL1SynchPoint> {
|
|
387
525
|
const [blocksSynchedTo, messagesSynchedTo] = await Promise.all([
|
|
@@ -394,44 +532,72 @@ export class KVArchiverDataStore implements ArchiverDataStore, ContractDataSourc
|
|
|
394
532
|
};
|
|
395
533
|
}
|
|
396
534
|
|
|
535
|
+
/** Estimates the size of the store in bytes. */
|
|
397
536
|
public estimateSize(): Promise<StoreSize> {
|
|
398
537
|
return this.db.estimateSize();
|
|
399
538
|
}
|
|
400
539
|
|
|
540
|
+
/** Deletes all L1 to L2 messages up until (excluding) the target checkpoint number. */
|
|
401
541
|
public rollbackL1ToL2MessagesToCheckpoint(targetCheckpointNumber: CheckpointNumber): Promise<void> {
|
|
402
542
|
return this.#messageStore.rollbackL1ToL2MessagesToCheckpoint(targetCheckpointNumber);
|
|
403
543
|
}
|
|
404
544
|
|
|
545
|
+
/** Returns an async iterator to all L1 to L2 messages on the range. */
|
|
405
546
|
public iterateL1ToL2Messages(range: CustomRange<bigint> = {}): AsyncIterableIterator<InboxMessage> {
|
|
406
547
|
return this.#messageStore.iterateL1ToL2Messages(range);
|
|
407
548
|
}
|
|
408
549
|
|
|
550
|
+
/** Removes all L1 to L2 messages starting from the given index (inclusive). */
|
|
409
551
|
public removeL1ToL2Messages(startIndex: bigint): Promise<void> {
|
|
410
552
|
return this.#messageStore.removeL1ToL2Messages(startIndex);
|
|
411
553
|
}
|
|
412
554
|
|
|
413
|
-
|
|
555
|
+
/** Returns the last synced validation status of the pending chain. */
|
|
556
|
+
public getPendingChainValidationStatus(): Promise<ValidateCheckpointResult | undefined> {
|
|
414
557
|
return this.#blockStore.getPendingChainValidationStatus();
|
|
415
558
|
}
|
|
416
559
|
|
|
417
|
-
|
|
560
|
+
/** Sets the last synced validation status of the pending chain. */
|
|
561
|
+
public setPendingChainValidationStatus(status: ValidateCheckpointResult | undefined): Promise<void> {
|
|
418
562
|
return this.#blockStore.setPendingChainValidationStatus(status);
|
|
419
563
|
}
|
|
420
564
|
|
|
565
|
+
/**
|
|
566
|
+
* Gets the number of the latest L2 block processed.
|
|
567
|
+
* @returns The number of the latest L2 block processed.
|
|
568
|
+
*/
|
|
421
569
|
public getCheckpointedL2BlockNumber(): Promise<BlockNumber> {
|
|
422
570
|
return this.#blockStore.getCheckpointedL2BlockNumber();
|
|
423
571
|
}
|
|
572
|
+
/**
|
|
573
|
+
* Gets the number of the latest published checkpoint processed.
|
|
574
|
+
* @returns The number of the latest published checkpoint processed
|
|
575
|
+
*/
|
|
424
576
|
public getSynchedCheckpointNumber(): Promise<CheckpointNumber> {
|
|
425
577
|
return this.#blockStore.getLatestCheckpointNumber();
|
|
426
578
|
}
|
|
579
|
+
/**
|
|
580
|
+
* Stores the l1 block number that checkpoints have been synched until
|
|
581
|
+
* @param l1BlockNumber - The l1 block number
|
|
582
|
+
*/
|
|
427
583
|
async setCheckpointSynchedL1BlockNumber(l1BlockNumber: bigint): Promise<void> {
|
|
428
584
|
await this.#blockStore.setSynchedL1BlockNumber(l1BlockNumber);
|
|
429
585
|
}
|
|
430
586
|
|
|
587
|
+
/**
|
|
588
|
+
* Retrieves all blocks for the requested checkpoint
|
|
589
|
+
* @param checkpointNumber Retrieves all blocks for the given checkpoint
|
|
590
|
+
* @returns The collection of blocks for the requested checkpoint if available (undefined otherwise)
|
|
591
|
+
*/
|
|
431
592
|
getBlocksForCheckpoint(checkpointNumber: CheckpointNumber): Promise<L2BlockNew[] | undefined> {
|
|
432
593
|
return this.#blockStore.getBlocksForCheckpoint(checkpointNumber);
|
|
433
594
|
}
|
|
434
595
|
|
|
596
|
+
/**
|
|
597
|
+
* Returns checkpoint data for the requested checkpoint number
|
|
598
|
+
* @param checkpointNumber - The checkpoint requested
|
|
599
|
+
* @returns The checkpoint data or undefined if not found
|
|
600
|
+
*/
|
|
435
601
|
getCheckpointData(checkpointNumber: CheckpointNumber): Promise<CheckpointData | undefined> {
|
|
436
602
|
return this.#blockStore.getCheckpointData(checkpointNumber);
|
|
437
603
|
}
|
|
@@ -72,7 +72,7 @@ export class CalldataRetriever {
|
|
|
72
72
|
*/
|
|
73
73
|
async getCheckpointFromRollupTx(
|
|
74
74
|
txHash: `0x${string}`,
|
|
75
|
-
|
|
75
|
+
_blobHashes: Buffer[],
|
|
76
76
|
checkpointNumber: CheckpointNumber,
|
|
77
77
|
expectedHashes: {
|
|
78
78
|
attestationsHash?: Hex;
|
|
@@ -459,7 +459,7 @@ export class CalldataRetriever {
|
|
|
459
459
|
// Use ConsensusPayload to compute the digest - this ensures we match the exact logic
|
|
460
460
|
// used by the network for signing and verification
|
|
461
461
|
const consensusPayload = new ConsensusPayload(header, archiveRoot);
|
|
462
|
-
const payloadToSign = consensusPayload.getPayloadToSign(SignatureDomainSeparator.
|
|
462
|
+
const payloadToSign = consensusPayload.getPayloadToSign(SignatureDomainSeparator.checkpointAttestation);
|
|
463
463
|
const computedPayloadDigest = keccak256(payloadToSign);
|
|
464
464
|
|
|
465
465
|
// Compare as buffers to avoid case-sensitivity and string comparison issues
|