@aztec/archiver 0.0.0-test.1 → 0.0.1-commit.21caa21
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 +27 -6
- package/dest/archiver/archiver.d.ts +147 -57
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +841 -333
- package/dest/archiver/archiver_store.d.ts +85 -50
- 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 +708 -213
- package/dest/archiver/config.d.ts +5 -21
- package/dest/archiver/config.d.ts.map +1 -1
- package/dest/archiver/config.js +21 -12
- package/dest/archiver/data_retrieval.d.ts +32 -27
- package/dest/archiver/data_retrieval.d.ts.map +1 -1
- package/dest/archiver/data_retrieval.js +197 -94
- package/dest/archiver/errors.d.ts +9 -1
- package/dest/archiver/errors.d.ts.map +1 -1
- package/dest/archiver/errors.js +12 -0
- package/dest/archiver/index.d.ts +3 -4
- package/dest/archiver/index.d.ts.map +1 -1
- package/dest/archiver/index.js +1 -2
- package/dest/archiver/instrumentation.d.ts +12 -6
- package/dest/archiver/instrumentation.d.ts.map +1 -1
- package/dest/archiver/instrumentation.js +58 -17
- package/dest/archiver/kv_archiver_store/block_store.d.ts +48 -11
- package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/block_store.js +216 -63
- package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +3 -3
- package/dest/archiver/kv_archiver_store/contract_class_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/contract_class_store.js +12 -18
- package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +11 -8
- package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/contract_instance_store.js +30 -16
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +50 -35
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.js +88 -46
- package/dest/archiver/kv_archiver_store/log_store.d.ts +2 -2
- package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/log_store.js +18 -46
- package/dest/archiver/kv_archiver_store/message_store.d.ts +23 -17
- package/dest/archiver/kv_archiver_store/message_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/message_store.js +150 -48
- package/dest/archiver/structs/data_retrieval.d.ts +1 -1
- package/dest/archiver/structs/inbox_message.d.ts +15 -0
- package/dest/archiver/structs/inbox_message.d.ts.map +1 -0
- package/dest/archiver/structs/inbox_message.js +38 -0
- package/dest/archiver/structs/published.d.ts +3 -11
- package/dest/archiver/structs/published.d.ts.map +1 -1
- package/dest/archiver/structs/published.js +1 -1
- package/dest/archiver/validation.d.ts +17 -0
- package/dest/archiver/validation.d.ts.map +1 -0
- package/dest/archiver/validation.js +98 -0
- package/dest/factory.d.ts +8 -13
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +18 -49
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/rpc/index.d.ts +2 -3
- package/dest/rpc/index.d.ts.map +1 -1
- package/dest/rpc/index.js +1 -4
- package/dest/test/index.d.ts +1 -1
- package/dest/test/mock_archiver.d.ts +2 -2
- package/dest/test/mock_archiver.d.ts.map +1 -1
- package/dest/test/mock_l1_to_l2_message_source.d.ts +5 -3
- package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/test/mock_l1_to_l2_message_source.js +14 -1
- package/dest/test/mock_l2_block_source.d.ts +38 -10
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +119 -8
- package/dest/test/mock_structs.d.ts +9 -0
- package/dest/test/mock_structs.d.ts.map +1 -0
- package/dest/test/mock_structs.js +37 -0
- package/package.json +28 -30
- package/src/archiver/archiver.ts +1087 -410
- package/src/archiver/archiver_store.ts +97 -55
- package/src/archiver/archiver_store_test_suite.ts +664 -210
- package/src/archiver/config.ts +28 -41
- package/src/archiver/data_retrieval.ts +279 -125
- package/src/archiver/errors.ts +21 -0
- package/src/archiver/index.ts +2 -3
- package/src/archiver/instrumentation.ts +77 -22
- package/src/archiver/kv_archiver_store/block_store.ts +270 -72
- package/src/archiver/kv_archiver_store/contract_class_store.ts +13 -23
- package/src/archiver/kv_archiver_store/contract_instance_store.ts +35 -27
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +127 -63
- package/src/archiver/kv_archiver_store/log_store.ts +24 -62
- package/src/archiver/kv_archiver_store/message_store.ts +209 -53
- package/src/archiver/structs/inbox_message.ts +41 -0
- package/src/archiver/structs/published.ts +2 -11
- package/src/archiver/validation.ts +124 -0
- package/src/factory.ts +24 -66
- package/src/index.ts +1 -1
- package/src/rpc/index.ts +1 -5
- package/src/test/mock_archiver.ts +1 -1
- package/src/test/mock_l1_to_l2_message_source.ts +14 -3
- package/src/test/mock_l2_block_source.ts +158 -13
- package/src/test/mock_structs.ts +49 -0
- package/dest/archiver/kv_archiver_store/nullifier_store.d.ts +0 -12
- package/dest/archiver/kv_archiver_store/nullifier_store.d.ts.map +0 -1
- package/dest/archiver/kv_archiver_store/nullifier_store.js +0 -73
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts +0 -23
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts.map +0 -1
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.js +0 -49
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts +0 -175
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts.map +0 -1
- package/dest/archiver/memory_archiver_store/memory_archiver_store.js +0 -636
- package/src/archiver/kv_archiver_store/nullifier_store.ts +0 -97
- package/src/archiver/memory_archiver_store/l1_to_l2_message_store.ts +0 -61
- package/src/archiver/memory_archiver_store/memory_archiver_store.ts +0 -801
package/src/archiver/config.ts
CHANGED
|
@@ -1,62 +1,31 @@
|
|
|
1
1
|
import { type BlobSinkConfig, blobSinkConfigMapping } from '@aztec/blob-sink/client';
|
|
2
2
|
import {
|
|
3
|
-
type L1ContractAddresses,
|
|
4
3
|
type L1ContractsConfig,
|
|
5
4
|
type L1ReaderConfig,
|
|
5
|
+
l1ContractAddressesMapping,
|
|
6
6
|
l1ContractsConfigMappings,
|
|
7
7
|
l1ReaderConfigMappings,
|
|
8
8
|
} from '@aztec/ethereum';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
type ConfigMappingsType,
|
|
11
|
+
booleanConfigHelper,
|
|
12
|
+
getConfigFromMappings,
|
|
13
|
+
numberConfigHelper,
|
|
14
|
+
} from '@aztec/foundation/config';
|
|
10
15
|
import { type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config';
|
|
16
|
+
import type { ArchiverSpecificConfig } from '@aztec/stdlib/interfaces/server';
|
|
11
17
|
|
|
12
18
|
/**
|
|
19
|
+
* The archiver configuration.
|
|
13
20
|
* There are 2 polling intervals used in this configuration. The first is the archiver polling interval, archiverPollingIntervalMS.
|
|
14
21
|
* This is the interval between successive calls to eth_blockNumber via viem.
|
|
15
22
|
* Results of calls to eth_blockNumber are cached by viem with this cache being updated periodically at the interval specified by viemPollingIntervalMS.
|
|
16
23
|
* As a result the maximum observed polling time for new blocks will be viemPollingIntervalMS + archiverPollingIntervalMS.
|
|
17
24
|
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The archiver configuration.
|
|
21
|
-
*/
|
|
22
|
-
export type ArchiverConfig = {
|
|
23
|
-
/** URL for an archiver service. If set, will return an archiver client as opposed to starting a new one. */
|
|
24
|
-
archiverUrl?: string;
|
|
25
|
-
|
|
26
|
-
/** URL for an L1 consensus client */
|
|
27
|
-
l1ConsensusHostUrl?: string;
|
|
28
|
-
|
|
29
|
-
/** The polling interval in ms for retrieving new L2 blocks and encrypted logs. */
|
|
30
|
-
archiverPollingIntervalMS?: number;
|
|
31
|
-
|
|
32
|
-
/** The number of L2 blocks the archiver will attempt to download at a time. */
|
|
33
|
-
archiverBatchSize?: number;
|
|
34
|
-
|
|
35
|
-
/** The polling interval viem uses in ms */
|
|
36
|
-
viemPollingIntervalMS?: number;
|
|
37
|
-
|
|
38
|
-
/** The deployed L1 contract addresses */
|
|
39
|
-
l1Contracts: L1ContractAddresses;
|
|
40
|
-
|
|
41
|
-
/** The max number of logs that can be obtained in 1 "getPublicLogs" call. */
|
|
42
|
-
maxLogs?: number;
|
|
43
|
-
} & L1ReaderConfig &
|
|
44
|
-
L1ContractsConfig &
|
|
45
|
-
BlobSinkConfig &
|
|
46
|
-
ChainConfig;
|
|
25
|
+
export type ArchiverConfig = ArchiverSpecificConfig & L1ReaderConfig & L1ContractsConfig & BlobSinkConfig & ChainConfig;
|
|
47
26
|
|
|
48
27
|
export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
|
|
49
28
|
...blobSinkConfigMapping,
|
|
50
|
-
archiverUrl: {
|
|
51
|
-
env: 'ARCHIVER_URL',
|
|
52
|
-
description:
|
|
53
|
-
'URL for an archiver service. If set, will return an archiver client as opposed to starting a new one.',
|
|
54
|
-
},
|
|
55
|
-
l1ConsensusHostUrl: {
|
|
56
|
-
env: 'L1_CONSENSUS_HOST_URL',
|
|
57
|
-
description: 'URL for an L1 consensus client.',
|
|
58
|
-
parseEnv: (val: string) => val,
|
|
59
|
-
},
|
|
60
29
|
archiverPollingIntervalMS: {
|
|
61
30
|
env: 'ARCHIVER_POLLING_INTERVAL_MS',
|
|
62
31
|
description: 'The polling interval in ms for retrieving new L2 blocks and encrypted logs.',
|
|
@@ -72,6 +41,20 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
|
|
|
72
41
|
description: 'The max number of logs that can be obtained in 1 "getPublicLogs" call.',
|
|
73
42
|
...numberConfigHelper(1_000),
|
|
74
43
|
},
|
|
44
|
+
archiverStoreMapSizeKb: {
|
|
45
|
+
env: 'ARCHIVER_STORE_MAP_SIZE_KB',
|
|
46
|
+
parseEnv: (val: string | undefined) => (val ? +val : undefined),
|
|
47
|
+
description: 'The maximum possible size of the archiver DB in KB. Overwrites the general dataStoreMapSizeKb.',
|
|
48
|
+
},
|
|
49
|
+
skipValidateBlockAttestations: {
|
|
50
|
+
description: 'Whether to skip validating block attestations (use only for testing).',
|
|
51
|
+
...booleanConfigHelper(false),
|
|
52
|
+
},
|
|
53
|
+
maxAllowedEthClientDriftSeconds: {
|
|
54
|
+
env: 'MAX_ALLOWED_ETH_CLIENT_DRIFT_SECONDS',
|
|
55
|
+
description: 'Maximum allowed drift in seconds between the Ethereum client and current time.',
|
|
56
|
+
...numberConfigHelper(300),
|
|
57
|
+
},
|
|
75
58
|
...chainConfigMappings,
|
|
76
59
|
...l1ReaderConfigMappings,
|
|
77
60
|
viemPollingIntervalMS: {
|
|
@@ -80,6 +63,10 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
|
|
|
80
63
|
...numberConfigHelper(1000),
|
|
81
64
|
},
|
|
82
65
|
...l1ContractsConfigMappings,
|
|
66
|
+
l1Contracts: {
|
|
67
|
+
description: 'The deployed L1 contract addresses',
|
|
68
|
+
nested: l1ContractAddressesMapping,
|
|
69
|
+
},
|
|
83
70
|
};
|
|
84
71
|
|
|
85
72
|
/**
|