@aztec/archiver 3.0.0-rc.5 → 4.0.0-nightly.20260107
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/dest/archiver/archiver.d.ts +69 -49
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +777 -214
- package/dest/archiver/archiver_store.d.ts +89 -30
- package/dest/archiver/archiver_store.d.ts.map +1 -1
- package/dest/archiver/archiver_store_test_suite.d.ts +1 -1
- package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -1
- package/dest/archiver/archiver_store_test_suite.js +1785 -288
- package/dest/archiver/config.d.ts +3 -3
- package/dest/archiver/config.d.ts.map +1 -1
- package/dest/archiver/config.js +2 -2
- package/dest/archiver/errors.d.ts +25 -1
- package/dest/archiver/errors.d.ts.map +1 -1
- package/dest/archiver/errors.js +37 -0
- package/dest/archiver/index.d.ts +2 -2
- package/dest/archiver/index.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/block_store.d.ts +49 -17
- package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/block_store.js +320 -84
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +33 -37
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.js +60 -35
- package/dest/archiver/kv_archiver_store/log_store.d.ts +14 -11
- package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/log_store.js +149 -62
- package/dest/archiver/l1/bin/retrieve-calldata.js +5 -3
- package/dest/archiver/l1/calldata_retriever.d.ts +17 -3
- package/dest/archiver/l1/calldata_retriever.d.ts.map +1 -1
- package/dest/archiver/l1/calldata_retriever.js +75 -7
- package/dest/archiver/l1/data_retrieval.d.ts +13 -10
- package/dest/archiver/l1/data_retrieval.d.ts.map +1 -1
- package/dest/archiver/l1/data_retrieval.js +31 -18
- package/dest/archiver/structs/published.d.ts +1 -2
- package/dest/archiver/structs/published.d.ts.map +1 -1
- package/dest/factory.d.ts +1 -1
- package/dest/factory.js +1 -1
- package/dest/test/mock_l2_block_source.d.ts +10 -3
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +16 -15
- package/package.json +13 -13
- package/src/archiver/archiver.ts +509 -260
- package/src/archiver/archiver_store.ts +99 -29
- package/src/archiver/archiver_store_test_suite.ts +1831 -274
- package/src/archiver/config.ts +7 -3
- package/src/archiver/errors.ts +64 -0
- package/src/archiver/index.ts +1 -1
- package/src/archiver/kv_archiver_store/block_store.ts +434 -94
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +74 -49
- package/src/archiver/kv_archiver_store/log_store.ts +213 -77
- package/src/archiver/l1/bin/retrieve-calldata.ts +3 -3
- package/src/archiver/l1/calldata_retriever.ts +116 -6
- package/src/archiver/l1/data_retrieval.ts +41 -20
- package/src/archiver/structs/published.ts +0 -1
- package/src/factory.ts +1 -1
- package/src/test/mock_l2_block_source.ts +20 -16
package/src/archiver/config.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type BlobClientConfig, blobClientConfigMapping } from '@aztec/blob-client/client/config';
|
|
2
2
|
import { type L1ContractsConfig, l1ContractsConfigMappings } from '@aztec/ethereum/config';
|
|
3
3
|
import { l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresses';
|
|
4
4
|
import { type L1ReaderConfig, l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
|
|
@@ -18,10 +18,14 @@ import type { ArchiverSpecificConfig } from '@aztec/stdlib/interfaces/server';
|
|
|
18
18
|
* Results of calls to eth_blockNumber are cached by viem with this cache being updated periodically at the interval specified by viemPollingIntervalMS.
|
|
19
19
|
* As a result the maximum observed polling time for new blocks will be viemPollingIntervalMS + archiverPollingIntervalMS.
|
|
20
20
|
*/
|
|
21
|
-
export type ArchiverConfig = ArchiverSpecificConfig &
|
|
21
|
+
export type ArchiverConfig = ArchiverSpecificConfig &
|
|
22
|
+
L1ReaderConfig &
|
|
23
|
+
L1ContractsConfig &
|
|
24
|
+
BlobClientConfig &
|
|
25
|
+
ChainConfig;
|
|
22
26
|
|
|
23
27
|
export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
|
|
24
|
-
...
|
|
28
|
+
...blobClientConfigMapping,
|
|
25
29
|
archiverPollingIntervalMS: {
|
|
26
30
|
env: 'ARCHIVER_POLLING_INTERVAL_MS',
|
|
27
31
|
description: 'The polling interval in ms for retrieving new L2 blocks and encrypted logs.',
|
package/src/archiver/errors.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/schemas';
|
|
2
|
+
|
|
1
3
|
export class NoBlobBodiesFoundError extends Error {
|
|
2
4
|
constructor(l2BlockNum: number) {
|
|
3
5
|
super(`No blob bodies found for block ${l2BlockNum}`);
|
|
@@ -24,3 +26,65 @@ export class BlockNumberNotSequentialError extends Error {
|
|
|
24
26
|
);
|
|
25
27
|
}
|
|
26
28
|
}
|
|
29
|
+
|
|
30
|
+
export class InitialCheckpointNumberNotSequentialError extends Error {
|
|
31
|
+
constructor(
|
|
32
|
+
public readonly newCheckpointNumber: number,
|
|
33
|
+
public readonly previousCheckpointNumber: number | undefined,
|
|
34
|
+
) {
|
|
35
|
+
super(
|
|
36
|
+
`Cannot insert new checkpoint ${newCheckpointNumber} given previous checkpoint number in store is ${
|
|
37
|
+
previousCheckpointNumber ?? 'undefined'
|
|
38
|
+
}`,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class CheckpointNumberNotSequentialError extends Error {
|
|
44
|
+
constructor(newCheckpointNumber: number, previous: number | undefined) {
|
|
45
|
+
super(
|
|
46
|
+
`Cannot insert new checkpoint ${newCheckpointNumber} given previous checkpoint number in batch is ${previous ?? 'undefined'}`,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export class CheckpointNumberNotConsistentError extends Error {
|
|
52
|
+
constructor(newCheckpointNumber: number, previous: number | undefined) {
|
|
53
|
+
super(
|
|
54
|
+
`Cannot insert block for new checkpoint ${newCheckpointNumber} given previous block was checkpoint ${previous ?? 'undefined'}`,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export class BlockIndexNotSequentialError extends Error {
|
|
60
|
+
constructor(newBlockIndex: number, previousBlockIndex: number | undefined) {
|
|
61
|
+
super(
|
|
62
|
+
`Cannot insert new block at checkpoint index ${newBlockIndex} given previous block index is ${previousBlockIndex ?? 'undefined'}`,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export class BlockArchiveNotConsistentError extends Error {
|
|
68
|
+
constructor(
|
|
69
|
+
newBlockNumber: number,
|
|
70
|
+
previousBlockNumber: number | undefined,
|
|
71
|
+
newBlockArchive: Fr,
|
|
72
|
+
previousBlockArchive: Fr,
|
|
73
|
+
) {
|
|
74
|
+
super(
|
|
75
|
+
`Cannot insert new block number ${newBlockNumber} with archive ${newBlockArchive.toString()} previous block number is ${previousBlockNumber ?? 'undefined'}, previous archive is ${previousBlockArchive?.toString() ?? 'undefined'}`,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export class CheckpointNotFoundError extends Error {
|
|
81
|
+
constructor(checkpointNumber: number) {
|
|
82
|
+
super(`Failed to find expected checkpoint number ${checkpointNumber}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export class BlockNotFoundError extends Error {
|
|
87
|
+
constructor(blockNumber: number) {
|
|
88
|
+
super(`Failed to find expected block number ${blockNumber}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
package/src/archiver/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './archiver.js';
|
|
2
2
|
export * from './config.js';
|
|
3
|
-
export { type
|
|
3
|
+
export { type L1PublishedData } from './structs/published.js';
|
|
4
4
|
export type { ArchiverDataStore } from './archiver_store.js';
|
|
5
5
|
export { KVArchiverDataStore, ARCHIVER_DB_VERSION } from './kv_archiver_store/kv_archiver_store.js';
|
|
6
6
|
export { ContractInstanceStore } from './kv_archiver_store/contract_instance_store.js';
|