@aztec/archiver 0.0.1-commit.f504929 → 0.0.1-commit.f5a9928
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 +19 -13
- package/dest/archiver.d.ts +73 -18
- package/dest/archiver.d.ts.map +1 -1
- package/dest/archiver.js +321 -81
- package/dest/config.d.ts +7 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +43 -14
- package/dest/errors.d.ts +55 -9
- package/dest/errors.d.ts.map +1 -1
- package/dest/errors.js +81 -14
- package/dest/factory.d.ts +20 -9
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +85 -37
- package/dest/index.d.ts +11 -3
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +10 -2
- package/dest/l1/calldata_retriever.d.ts +9 -1
- package/dest/l1/calldata_retriever.d.ts.map +1 -1
- package/dest/l1/calldata_retriever.js +22 -11
- package/dest/l1/data_retrieval.d.ts +25 -11
- package/dest/l1/data_retrieval.d.ts.map +1 -1
- package/dest/l1/data_retrieval.js +25 -32
- package/dest/l1/trace_tx.d.ts +12 -66
- package/dest/l1/trace_tx.d.ts.map +1 -1
- package/dest/l1/validate_historical_logs.d.ts +23 -0
- package/dest/l1/validate_historical_logs.d.ts.map +1 -0
- package/dest/l1/validate_historical_logs.js +108 -0
- package/dest/modules/contract_data_source_adapter.d.ts +25 -0
- package/dest/modules/contract_data_source_adapter.d.ts.map +1 -0
- package/dest/modules/contract_data_source_adapter.js +32 -0
- package/dest/modules/data_source_base.d.ts +73 -50
- package/dest/modules/data_source_base.d.ts.map +1 -1
- package/dest/modules/data_source_base.js +250 -144
- package/dest/modules/data_store_updater.d.ts +42 -17
- package/dest/modules/data_store_updater.d.ts.map +1 -1
- package/dest/modules/data_store_updater.js +198 -123
- package/dest/modules/instrumentation.d.ts +15 -2
- package/dest/modules/instrumentation.d.ts.map +1 -1
- package/dest/modules/instrumentation.js +48 -9
- package/dest/modules/l1_synchronizer.d.ts +14 -8
- package/dest/modules/l1_synchronizer.d.ts.map +1 -1
- package/dest/modules/l1_synchronizer.js +477 -213
- package/dest/modules/outbox_trees_resolver.d.ts +64 -0
- package/dest/modules/outbox_trees_resolver.d.ts.map +1 -0
- package/dest/modules/outbox_trees_resolver.js +184 -0
- package/dest/modules/validation.d.ts +30 -7
- package/dest/modules/validation.d.ts.map +1 -1
- package/dest/modules/validation.js +35 -17
- package/dest/store/block_store.d.ts +186 -78
- package/dest/store/block_store.d.ts.map +1 -1
- package/dest/store/block_store.js +763 -290
- package/dest/store/contract_class_store.d.ts +17 -4
- package/dest/store/contract_class_store.d.ts.map +1 -1
- package/dest/store/contract_class_store.js +42 -68
- package/dest/store/contract_instance_store.d.ts +28 -1
- package/dest/store/contract_instance_store.d.ts.map +1 -1
- package/dest/store/contract_instance_store.js +58 -6
- package/dest/store/data_stores.d.ts +68 -0
- package/dest/store/data_stores.d.ts.map +1 -0
- package/dest/store/data_stores.js +54 -0
- package/dest/store/function_names_cache.d.ts +17 -0
- package/dest/store/function_names_cache.d.ts.map +1 -0
- package/dest/store/function_names_cache.js +30 -0
- package/dest/store/l2_tips_cache.d.ts +13 -7
- package/dest/store/l2_tips_cache.d.ts.map +1 -1
- package/dest/store/l2_tips_cache.js +13 -76
- package/dest/store/log_store.d.ts +42 -37
- package/dest/store/log_store.d.ts.map +1 -1
- package/dest/store/log_store.js +262 -408
- package/dest/store/log_store_codec.d.ts +78 -0
- package/dest/store/log_store_codec.d.ts.map +1 -0
- package/dest/store/log_store_codec.js +110 -0
- package/dest/store/message_store.d.ts +11 -1
- package/dest/store/message_store.d.ts.map +1 -1
- package/dest/store/message_store.js +51 -9
- package/dest/test/fake_l1_state.d.ts +20 -1
- package/dest/test/fake_l1_state.d.ts.map +1 -1
- package/dest/test/fake_l1_state.js +117 -21
- package/dest/test/mock_l2_block_source.d.ts +51 -52
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +232 -180
- package/dest/test/mock_structs.d.ts +4 -1
- package/dest/test/mock_structs.d.ts.map +1 -1
- package/dest/test/mock_structs.js +15 -3
- package/dest/test/noop_l1_archiver.d.ts +17 -6
- package/dest/test/noop_l1_archiver.d.ts.map +1 -1
- package/dest/test/noop_l1_archiver.js +31 -11
- package/package.json +15 -14
- package/src/archiver.ts +415 -90
- package/src/config.ts +51 -13
- package/src/errors.ts +122 -21
- package/src/factory.ts +99 -30
- package/src/index.ts +18 -2
- package/src/l1/calldata_retriever.ts +29 -11
- package/src/l1/data_retrieval.ts +44 -46
- package/src/l1/validate_historical_logs.ts +140 -0
- package/src/modules/contract_data_source_adapter.ts +46 -0
- package/src/modules/data_source_base.ts +327 -189
- package/src/modules/data_store_updater.ts +235 -155
- package/src/modules/instrumentation.ts +43 -10
- package/src/modules/l1_synchronizer.ts +646 -259
- package/src/modules/outbox_trees_resolver.ts +220 -0
- package/src/modules/validation.ts +80 -23
- package/src/store/block_store.ts +930 -348
- package/src/store/contract_class_store.ts +49 -103
- package/src/store/contract_instance_store.ts +74 -11
- package/src/store/data_stores.ts +104 -0
- package/src/store/function_names_cache.ts +37 -0
- package/src/store/l2_tips_cache.ts +16 -70
- package/src/store/log_store.ts +302 -559
- package/src/store/log_store_codec.ts +143 -0
- package/src/store/message_store.ts +60 -10
- package/src/structs/inbox_message.ts +1 -1
- package/src/test/fake_l1_state.ts +145 -32
- package/src/test/mock_l2_block_source.ts +292 -227
- package/src/test/mock_structs.ts +25 -8
- package/src/test/noop_l1_archiver.ts +61 -12
- package/dest/store/kv_archiver_store.d.ts +0 -354
- package/dest/store/kv_archiver_store.d.ts.map +0 -1
- package/dest/store/kv_archiver_store.js +0 -464
- package/src/store/kv_archiver_store.ts +0 -671
package/dest/config.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { blobClientConfigMapping } from '@aztec/blob-client/client/config';
|
|
2
2
|
import { l1ContractsConfigMappings } from '@aztec/ethereum/config';
|
|
3
|
-
import { l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresses';
|
|
4
3
|
import { l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
|
|
5
|
-
import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config';
|
|
4
|
+
import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, optionalNumberConfigHelper } from '@aztec/foundation/config';
|
|
6
5
|
import { chainConfigMappings } from '@aztec/stdlib/config';
|
|
6
|
+
import { DEFAULT_ORPHAN_PRUNE_NO_PROPOSAL_TOLERANCE } from '@aztec/stdlib/timetable';
|
|
7
7
|
export const archiverConfigMappings = {
|
|
8
8
|
...blobClientConfigMapping,
|
|
9
9
|
archiverPollingIntervalMS: {
|
|
@@ -16,20 +16,29 @@ export const archiverConfigMappings = {
|
|
|
16
16
|
description: 'The number of L2 blocks the archiver will attempt to download at a time.',
|
|
17
17
|
...numberConfigHelper(100)
|
|
18
18
|
},
|
|
19
|
-
maxLogs: {
|
|
20
|
-
env: 'ARCHIVER_MAX_LOGS',
|
|
21
|
-
description: 'The max number of logs that can be obtained in 1 "getPublicLogs" call.',
|
|
22
|
-
...numberConfigHelper(1_000)
|
|
23
|
-
},
|
|
24
19
|
archiverStoreMapSizeKb: {
|
|
25
20
|
env: 'ARCHIVER_STORE_MAP_SIZE_KB',
|
|
26
|
-
|
|
21
|
+
...optionalNumberConfigHelper(),
|
|
27
22
|
description: 'The maximum possible size of the archiver DB in KB. Overwrites the general dataStoreMapSizeKb.'
|
|
28
23
|
},
|
|
24
|
+
blockDurationMs: {
|
|
25
|
+
env: 'SEQ_BLOCK_DURATION_MS',
|
|
26
|
+
description: 'Duration per block in milliseconds when building multiple blocks per slot. Used to derive orphan proposed block pruning timing.',
|
|
27
|
+
...optionalNumberConfigHelper()
|
|
28
|
+
},
|
|
29
|
+
checkpointProposalSyncGraceSeconds: {
|
|
30
|
+
env: 'CHECKPOINT_PROPOSAL_SYNC_GRACE_SECONDS',
|
|
31
|
+
description: 'Consensus grace in seconds for a received checkpoint proposal to materialize into local proposed state.',
|
|
32
|
+
...optionalNumberConfigHelper()
|
|
33
|
+
},
|
|
29
34
|
skipValidateCheckpointAttestations: {
|
|
30
35
|
description: 'Skip validating checkpoint attestations (for testing purposes only)',
|
|
31
36
|
...booleanConfigHelper(false)
|
|
32
37
|
},
|
|
38
|
+
skipPromoteProposedCheckpointDuringL1Sync: {
|
|
39
|
+
description: 'Skip promoting proposed checkpoints during L1 sync (for testing purposes only)',
|
|
40
|
+
...booleanConfigHelper(false)
|
|
41
|
+
},
|
|
33
42
|
maxAllowedEthClientDriftSeconds: {
|
|
34
43
|
env: 'MAX_ALLOWED_ETH_CLIENT_DRIFT_SECONDS',
|
|
35
44
|
description: 'Maximum allowed drift in seconds between the Ethereum client and current time.',
|
|
@@ -40,6 +49,26 @@ export const archiverConfigMappings = {
|
|
|
40
49
|
description: 'Whether to allow starting the archiver without debug/trace method support on Ethereum hosts',
|
|
41
50
|
...booleanConfigHelper(true)
|
|
42
51
|
},
|
|
52
|
+
archiverSkipHistoricalLogsCheck: {
|
|
53
|
+
env: 'ARCHIVER_SKIP_HISTORICAL_LOGS_CHECK',
|
|
54
|
+
description: 'Skip the startup check that probes the L1 RPC for historical Rollup contract logs. ' + 'Set to true to bypass the check when the connected RPC node is known to prune old logs.',
|
|
55
|
+
...booleanConfigHelper(false)
|
|
56
|
+
},
|
|
57
|
+
orphanPruneNoProposalTolerance: {
|
|
58
|
+
env: 'ARCHIVER_ORPHAN_PRUNE_NO_PROPOSAL_TOLERANCE',
|
|
59
|
+
description: 'Local tolerance in seconds before pruning an orphan block when no checkpoint proposal was received.',
|
|
60
|
+
...numberConfigHelper(DEFAULT_ORPHAN_PRUNE_NO_PROPOSAL_TOLERANCE)
|
|
61
|
+
},
|
|
62
|
+
skipOrphanProposedBlockPruning: {
|
|
63
|
+
env: 'ARCHIVER_SKIP_ORPHAN_PROPOSED_BLOCK_PRUNING',
|
|
64
|
+
description: 'Skip pruning orphan proposed blocks that have no matching proposed checkpoint.',
|
|
65
|
+
...booleanConfigHelper(false)
|
|
66
|
+
},
|
|
67
|
+
testPreloadStandardContracts: {
|
|
68
|
+
env: 'TEST_PRELOAD_STANDARD_CONTRACTS',
|
|
69
|
+
description: 'Preload the standard contracts (AuthRegistry, PublicChecks, HandshakeRegistry) into the contract store at ' + 'block 0. For test environments only, and only safe when genesis seeds the matching registration/deployment ' + 'nullifiers; otherwise a later on-chain publish would collide with the block-0 preload.',
|
|
70
|
+
...booleanConfigHelper(false)
|
|
71
|
+
},
|
|
43
72
|
...chainConfigMappings,
|
|
44
73
|
...l1ReaderConfigMappings,
|
|
45
74
|
viemPollingIntervalMS: {
|
|
@@ -47,11 +76,7 @@ export const archiverConfigMappings = {
|
|
|
47
76
|
description: 'The polling interval viem uses in ms',
|
|
48
77
|
...numberConfigHelper(1000)
|
|
49
78
|
},
|
|
50
|
-
...l1ContractsConfigMappings
|
|
51
|
-
l1Contracts: {
|
|
52
|
-
description: 'The deployed L1 contract addresses',
|
|
53
|
-
nested: l1ContractAddressesMapping
|
|
54
|
-
}
|
|
79
|
+
...l1ContractsConfigMappings
|
|
55
80
|
};
|
|
56
81
|
/**
|
|
57
82
|
* Returns the archiver configuration from the environment variables.
|
|
@@ -65,7 +90,11 @@ export const archiverConfigMappings = {
|
|
|
65
90
|
pollingIntervalMs: config.archiverPollingIntervalMS,
|
|
66
91
|
batchSize: config.archiverBatchSize,
|
|
67
92
|
skipValidateCheckpointAttestations: config.skipValidateCheckpointAttestations,
|
|
93
|
+
skipPromoteProposedCheckpointDuringL1Sync: config.skipPromoteProposedCheckpointDuringL1Sync,
|
|
68
94
|
maxAllowedEthClientDriftSeconds: config.maxAllowedEthClientDriftSeconds,
|
|
69
|
-
ethereumAllowNoDebugHosts: config.ethereumAllowNoDebugHosts
|
|
95
|
+
ethereumAllowNoDebugHosts: config.ethereumAllowNoDebugHosts,
|
|
96
|
+
skipHistoricalLogsCheck: config.archiverSkipHistoricalLogsCheck,
|
|
97
|
+
orphanPruneNoProposalTolerance: config.orphanPruneNoProposalTolerance,
|
|
98
|
+
skipOrphanProposedBlockPruning: config.skipOrphanProposedBlockPruning
|
|
70
99
|
};
|
|
71
100
|
}
|
package/dest/errors.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
+
import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { Fr } from '@aztec/foundation/schemas';
|
|
2
3
|
export declare class NoBlobBodiesFoundError extends Error {
|
|
3
4
|
constructor(l2BlockNum: number);
|
|
4
5
|
}
|
|
5
|
-
export declare class InitialBlockNumberNotSequentialError extends Error {
|
|
6
|
-
readonly newBlockNumber: number;
|
|
7
|
-
readonly previousBlockNumber: number | undefined;
|
|
8
|
-
constructor(newBlockNumber: number, previousBlockNumber: number | undefined);
|
|
9
|
-
}
|
|
10
6
|
export declare class BlockNumberNotSequentialError extends Error {
|
|
11
7
|
constructor(newBlockNumber: number, previous: number | undefined);
|
|
12
8
|
}
|
|
@@ -16,10 +12,13 @@ export declare class InitialCheckpointNumberNotSequentialError extends Error {
|
|
|
16
12
|
constructor(newCheckpointNumber: number, previousCheckpointNumber: number | undefined);
|
|
17
13
|
}
|
|
18
14
|
export declare class CheckpointNumberNotSequentialError extends Error {
|
|
19
|
-
|
|
15
|
+
readonly newCheckpointNumber: CheckpointNumber;
|
|
16
|
+
readonly previousCheckpointNumber: CheckpointNumber | undefined;
|
|
17
|
+
constructor(newCheckpointNumber: CheckpointNumber, previousCheckpointNumber: CheckpointNumber | undefined, source?: 'proposed' | 'confirmed');
|
|
20
18
|
}
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
/** Thrown when a proposed block carries a checkpoint number that does not follow the latest one. */
|
|
20
|
+
export declare class BlockCheckpointNumberNotSequentialError extends Error {
|
|
21
|
+
constructor(blockNumber: BlockNumber, blockCheckpointNumber: CheckpointNumber, previous: CheckpointNumber | undefined);
|
|
23
22
|
}
|
|
24
23
|
export declare class BlockIndexNotSequentialError extends Error {
|
|
25
24
|
constructor(newBlockIndex: number, previousBlockIndex: number | undefined);
|
|
@@ -33,9 +32,56 @@ export declare class CheckpointNotFoundError extends Error {
|
|
|
33
32
|
export declare class BlockNotFoundError extends Error {
|
|
34
33
|
constructor(blockNumber: number);
|
|
35
34
|
}
|
|
35
|
+
/** Thrown when a proposed block matches a block that was already checkpointed. This is expected for late proposals. */
|
|
36
|
+
export declare class BlockAlreadyCheckpointedError extends Error {
|
|
37
|
+
readonly blockNumber: number;
|
|
38
|
+
constructor(blockNumber: number);
|
|
39
|
+
}
|
|
40
|
+
/** Thrown when L1 to L2 messages are requested for a checkpoint whose message tree hasn't been sealed yet. */
|
|
41
|
+
export declare class L1ToL2MessagesNotReadyError extends Error {
|
|
42
|
+
readonly checkpointNumber: number;
|
|
43
|
+
readonly inboxTreeInProgress: bigint;
|
|
44
|
+
constructor(checkpointNumber: number, inboxTreeInProgress: bigint);
|
|
45
|
+
}
|
|
46
|
+
/** Thrown when a proposed checkpoint number is stale (already processed). */
|
|
47
|
+
export declare class ProposedCheckpointStaleError extends Error {
|
|
48
|
+
readonly proposedCheckpointNumber: number;
|
|
49
|
+
readonly currentProposedNumber: number;
|
|
50
|
+
constructor(proposedCheckpointNumber: number, currentProposedNumber: number);
|
|
51
|
+
}
|
|
52
|
+
/** Thrown when a proposed checkpoint number is not the expected latestTip + 1. */
|
|
53
|
+
export declare class ProposedCheckpointNotSequentialError extends Error {
|
|
54
|
+
readonly proposedCheckpointNumber: number;
|
|
55
|
+
readonly latestTipNumber: number;
|
|
56
|
+
constructor(proposedCheckpointNumber: number, latestTipNumber: number);
|
|
57
|
+
}
|
|
58
|
+
/** Thrown when a proposed checkpoint or block L2 slot has already expired on L1. */
|
|
59
|
+
export declare class BlockOrCheckpointSlotExpiredError extends Error {
|
|
60
|
+
readonly slot: number;
|
|
61
|
+
readonly nextSlotStart: bigint;
|
|
62
|
+
readonly l1TimestampSynced: bigint | undefined;
|
|
63
|
+
constructor(slot: number, nextSlotStart: bigint, l1TimestampSynced: bigint | undefined);
|
|
64
|
+
}
|
|
65
|
+
/** Thrown when attempting to promote a proposed checkpoint but no proposed checkpoint exists in the store. */
|
|
66
|
+
export declare class NoProposedCheckpointToPromoteError extends Error {
|
|
67
|
+
constructor();
|
|
68
|
+
}
|
|
69
|
+
/** Thrown when the archive root of the proposed checkpoint does not match the expected one. */
|
|
70
|
+
export declare class ProposedCheckpointArchiveRootMismatchError extends Error {
|
|
71
|
+
readonly expectedArchiveRoot: Fr;
|
|
72
|
+
readonly actualArchiveRoot: Fr;
|
|
73
|
+
constructor(expectedArchiveRoot: Fr, actualArchiveRoot: Fr);
|
|
74
|
+
}
|
|
75
|
+
/** Thrown when the proposed checkpoint does not directly follow the latest confirmed checkpoint. */
|
|
76
|
+
export declare class ProposedCheckpointPromotionNotSequentialError extends Error {
|
|
77
|
+
readonly proposedCheckpointNumber: number;
|
|
78
|
+
readonly latestCheckpointNumber: number;
|
|
79
|
+
constructor(proposedCheckpointNumber: number, latestCheckpointNumber: number);
|
|
80
|
+
}
|
|
81
|
+
/** Thrown when a proposed block conflicts with an already checkpointed block (different content). */
|
|
36
82
|
export declare class CannotOverwriteCheckpointedBlockError extends Error {
|
|
37
83
|
readonly blockNumber: number;
|
|
38
84
|
readonly lastCheckpointedBlock: number;
|
|
39
85
|
constructor(blockNumber: number, lastCheckpointedBlock: number);
|
|
40
86
|
}
|
|
41
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
87
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvZXJyb3JzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ3JGLE9BQU8sS0FBSyxFQUFFL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1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AAEpD,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,UAAU,EAAE,MAAM,EAG7B;CACF;AAED,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,YAAY,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAG/D;CACF;AAED,qBAAa,yCAA0C,SAAQ,KAAK;aAEhD,mBAAmB,EAAE,MAAM;aAC3B,wBAAwB,EAAE,MAAM,GAAG,SAAS;IAF9D,YACkB,mBAAmB,EAAE,MAAM,EAC3B,wBAAwB,EAAE,MAAM,GAAG,SAAS,EAQ7D;CACF;AAED,qBAAa,kCAAmC,SAAQ,KAAK;aAEzC,mBAAmB,EAAE,gBAAgB;aACrC,wBAAwB,EAAE,gBAAgB,GAAG,SAAS;IAFxE,YACkB,mBAAmB,EAAE,gBAAgB,EACrC,wBAAwB,EAAE,gBAAgB,GAAG,SAAS,EACtE,MAAM,CAAC,EAAE,UAAU,GAAG,WAAW,EAOlC;CACF;AAED,oGAAoG;AACpG,qBAAa,uCAAwC,SAAQ,KAAK;IAChE,YACE,WAAW,EAAE,WAAW,EACxB,qBAAqB,EAAE,gBAAgB,EACvC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,EAMvC;CACF;AAED,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,YAAY,aAAa,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,SAAS,EAKxE;CACF;AAED,qBAAa,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K;IAC3D,cAGC;CACF;AAED,+FAA+F;AAC/F,qBAAa,0CAA2C,SAAQ,KAAK;aAEjD,mBAAmB,EAAE,EAAE;aACvB,iBAAiB,EAAE,EAAE;IAFvC,YACkB,mBAAmB,EAAE,EAAE,EACvB,iBAAiB,EAAE,EAAE,EAMtC;CACF;AAED,oGAAoG;AACpG,qBAAa,6CAA8C,SAAQ,KAAK;aAEpD,wBAAwB,EAAE,MAAM;aAChC,sBAAsB,EAAE,MAAM;IAFhD,YACkB,wBAAwB,EAAE,MAAM,EAChC,sBAAsB,EAAE,MAAM,EAM/C;CACF;AAED,qGAAqG;AACrG,qBAAa,qCAAsC,SAAQ,KAAK;aAE5C,WAAW,EAAE,MAAM;aACnB,qBAAqB,EAAE,MAAM;IAF/C,YACkB,WAAW,EAAE,MAAM,EACnB,qBAAqB,EAAE,MAAM,EAM9C;CACF"}
|
package/dest/errors.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
export class NoBlobBodiesFoundError extends Error {
|
|
2
2
|
constructor(l2BlockNum){
|
|
3
3
|
super(`No blob bodies found for block ${l2BlockNum}`);
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export class InitialBlockNumberNotSequentialError extends Error {
|
|
7
|
-
newBlockNumber;
|
|
8
|
-
previousBlockNumber;
|
|
9
|
-
constructor(newBlockNumber, previousBlockNumber){
|
|
10
|
-
super(`Cannot insert new block ${newBlockNumber} given previous block number in store is ${previousBlockNumber ?? 'undefined'}`), this.newBlockNumber = newBlockNumber, this.previousBlockNumber = previousBlockNumber;
|
|
4
|
+
this.name = 'NoBlobBodiesFoundError';
|
|
11
5
|
}
|
|
12
6
|
}
|
|
13
7
|
export class BlockNumberNotSequentialError extends Error {
|
|
14
8
|
constructor(newBlockNumber, previous){
|
|
15
|
-
super(`Cannot insert new block ${newBlockNumber} given previous block number
|
|
9
|
+
super(`Cannot insert new block ${newBlockNumber} given previous block number is ${previous ?? 'undefined'}`);
|
|
10
|
+
this.name = 'BlockNumberNotSequentialError';
|
|
16
11
|
}
|
|
17
12
|
}
|
|
18
13
|
export class InitialCheckpointNumberNotSequentialError extends Error {
|
|
@@ -20,39 +15,111 @@ export class InitialCheckpointNumberNotSequentialError extends Error {
|
|
|
20
15
|
previousCheckpointNumber;
|
|
21
16
|
constructor(newCheckpointNumber, previousCheckpointNumber){
|
|
22
17
|
super(`Cannot insert new checkpoint ${newCheckpointNumber} given previous checkpoint number in store is ${previousCheckpointNumber ?? 'undefined'}`), this.newCheckpointNumber = newCheckpointNumber, this.previousCheckpointNumber = previousCheckpointNumber;
|
|
18
|
+
this.name = 'InitialCheckpointNumberNotSequentialError';
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
21
|
export class CheckpointNumberNotSequentialError extends Error {
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
newCheckpointNumber;
|
|
23
|
+
previousCheckpointNumber;
|
|
24
|
+
constructor(newCheckpointNumber, previousCheckpointNumber, source){
|
|
25
|
+
const qualifier = source ? `${source} ` : '';
|
|
26
|
+
super(`Cannot insert new checkpoint ${newCheckpointNumber} given previous ${qualifier}checkpoint number is ${previousCheckpointNumber ?? 'undefined'}`), this.newCheckpointNumber = newCheckpointNumber, this.previousCheckpointNumber = previousCheckpointNumber;
|
|
27
|
+
this.name = 'CheckpointNumberNotSequentialError';
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
export class
|
|
31
|
-
constructor(
|
|
32
|
-
super(`Cannot insert block for
|
|
30
|
+
/** Thrown when a proposed block carries a checkpoint number that does not follow the latest one. */ export class BlockCheckpointNumberNotSequentialError extends Error {
|
|
31
|
+
constructor(blockNumber, blockCheckpointNumber, previous){
|
|
32
|
+
super(`Cannot insert new block ${blockNumber} for checkpoint ${blockCheckpointNumber} given previous checkpoint number is ${previous ?? 'undefined'}`);
|
|
33
|
+
this.name = 'BlockCheckpointNumberNotSequentialError';
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
export class BlockIndexNotSequentialError extends Error {
|
|
36
37
|
constructor(newBlockIndex, previousBlockIndex){
|
|
37
38
|
super(`Cannot insert new block at checkpoint index ${newBlockIndex} given previous block index is ${previousBlockIndex ?? 'undefined'}`);
|
|
39
|
+
this.name = 'BlockIndexNotSequentialError';
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
export class BlockArchiveNotConsistentError extends Error {
|
|
41
43
|
constructor(newBlockNumber, previousBlockNumber, newBlockArchive, previousBlockArchive){
|
|
42
44
|
super(`Cannot insert new block number ${newBlockNumber} with archive ${newBlockArchive.toString()} previous block number is ${previousBlockNumber ?? 'undefined'}, previous archive is ${previousBlockArchive?.toString() ?? 'undefined'}`);
|
|
45
|
+
this.name = 'BlockArchiveNotConsistentError';
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
export class CheckpointNotFoundError extends Error {
|
|
46
49
|
constructor(checkpointNumber){
|
|
47
50
|
super(`Failed to find expected checkpoint number ${checkpointNumber}`);
|
|
51
|
+
this.name = 'CheckpointNotFoundError';
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
export class BlockNotFoundError extends Error {
|
|
51
55
|
constructor(blockNumber){
|
|
52
56
|
super(`Failed to find expected block number ${blockNumber}`);
|
|
57
|
+
this.name = 'BlockNotFoundError';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** Thrown when a proposed block matches a block that was already checkpointed. This is expected for late proposals. */ export class BlockAlreadyCheckpointedError extends Error {
|
|
61
|
+
blockNumber;
|
|
62
|
+
constructor(blockNumber){
|
|
63
|
+
super(`Block ${blockNumber} has already been checkpointed with the same content`), this.blockNumber = blockNumber;
|
|
64
|
+
this.name = 'BlockAlreadyCheckpointedError';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** Thrown when L1 to L2 messages are requested for a checkpoint whose message tree hasn't been sealed yet. */ export class L1ToL2MessagesNotReadyError extends Error {
|
|
68
|
+
checkpointNumber;
|
|
69
|
+
inboxTreeInProgress;
|
|
70
|
+
constructor(checkpointNumber, inboxTreeInProgress){
|
|
71
|
+
super(`Cannot get L1 to L2 messages for checkpoint ${checkpointNumber}: ` + `inbox tree in progress is ${inboxTreeInProgress}, messages not yet sealed`), this.checkpointNumber = checkpointNumber, this.inboxTreeInProgress = inboxTreeInProgress;
|
|
72
|
+
this.name = 'L1ToL2MessagesNotReadyError';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** Thrown when a proposed checkpoint number is stale (already processed). */ export class ProposedCheckpointStaleError extends Error {
|
|
76
|
+
proposedCheckpointNumber;
|
|
77
|
+
currentProposedNumber;
|
|
78
|
+
constructor(proposedCheckpointNumber, currentProposedNumber){
|
|
79
|
+
super(`Stale proposed checkpoint ${proposedCheckpointNumber}: current proposed is ${currentProposedNumber}`), this.proposedCheckpointNumber = proposedCheckpointNumber, this.currentProposedNumber = currentProposedNumber;
|
|
80
|
+
this.name = 'ProposedCheckpointStaleError';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** Thrown when a proposed checkpoint number is not the expected latestTip + 1. */ export class ProposedCheckpointNotSequentialError extends Error {
|
|
84
|
+
proposedCheckpointNumber;
|
|
85
|
+
latestTipNumber;
|
|
86
|
+
constructor(proposedCheckpointNumber, latestTipNumber){
|
|
87
|
+
super(`Proposed checkpoint ${proposedCheckpointNumber} is not sequential: expected ${latestTipNumber + 1} (latest tip + 1, where tip is highest of confirmed or pending)`), this.proposedCheckpointNumber = proposedCheckpointNumber, this.latestTipNumber = latestTipNumber;
|
|
88
|
+
this.name = 'ProposedCheckpointNotSequentialError';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/** Thrown when a proposed checkpoint or block L2 slot has already expired on L1. */ export class BlockOrCheckpointSlotExpiredError extends Error {
|
|
92
|
+
slot;
|
|
93
|
+
nextSlotStart;
|
|
94
|
+
l1TimestampSynced;
|
|
95
|
+
constructor(slot, nextSlotStart, l1TimestampSynced){
|
|
96
|
+
super(`Checkpoint or block for slot ${slot} is expired: L1 synced to ${l1TimestampSynced} which is past the next slot start ${nextSlotStart}. ` + `If the checkpoint still lands via a late L1 tx, the archiver will pick it up via normal L1-sync (not the pending-queue shortcut).`), this.slot = slot, this.nextSlotStart = nextSlotStart, this.l1TimestampSynced = l1TimestampSynced;
|
|
97
|
+
this.name = 'BlockOrCheckpointSlotExpiredError';
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** Thrown when attempting to promote a proposed checkpoint but no proposed checkpoint exists in the store. */ export class NoProposedCheckpointToPromoteError extends Error {
|
|
101
|
+
constructor(){
|
|
102
|
+
super('Cannot promote proposed checkpoint: no proposed checkpoint exists');
|
|
103
|
+
this.name = 'NoProposedCheckpointToPromoteError';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** Thrown when the archive root of the proposed checkpoint does not match the expected one. */ export class ProposedCheckpointArchiveRootMismatchError extends Error {
|
|
107
|
+
expectedArchiveRoot;
|
|
108
|
+
actualArchiveRoot;
|
|
109
|
+
constructor(expectedArchiveRoot, actualArchiveRoot){
|
|
110
|
+
super(`Cannot promote proposed checkpoint: archive root mismatch (expected ${expectedArchiveRoot}, got ${actualArchiveRoot})`), this.expectedArchiveRoot = expectedArchiveRoot, this.actualArchiveRoot = actualArchiveRoot;
|
|
111
|
+
this.name = 'ProposedCheckpointArchiveRootMismatchError';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/** Thrown when the proposed checkpoint does not directly follow the latest confirmed checkpoint. */ export class ProposedCheckpointPromotionNotSequentialError extends Error {
|
|
115
|
+
proposedCheckpointNumber;
|
|
116
|
+
latestCheckpointNumber;
|
|
117
|
+
constructor(proposedCheckpointNumber, latestCheckpointNumber){
|
|
118
|
+
super(`Cannot promote proposed checkpoint: not sequential (latest ${latestCheckpointNumber}, proposed ${proposedCheckpointNumber})`), this.proposedCheckpointNumber = proposedCheckpointNumber, this.latestCheckpointNumber = latestCheckpointNumber;
|
|
119
|
+
this.name = 'ProposedCheckpointPromotionNotSequentialError';
|
|
53
120
|
}
|
|
54
121
|
}
|
|
55
|
-
export class CannotOverwriteCheckpointedBlockError extends Error {
|
|
122
|
+
/** Thrown when a proposed block conflicts with an already checkpointed block (different content). */ export class CannotOverwriteCheckpointedBlockError extends Error {
|
|
56
123
|
blockNumber;
|
|
57
124
|
lastCheckpointedBlock;
|
|
58
125
|
constructor(blockNumber, lastCheckpointedBlock){
|
package/dest/factory.d.ts
CHANGED
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { BlockHash } from '@aztec/stdlib/block';
|
|
2
|
+
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
3
|
+
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
3
4
|
import { Archiver, type ArchiverDeps } from './archiver.js';
|
|
4
5
|
import { type ArchiverConfig } from './config.js';
|
|
5
|
-
import {
|
|
6
|
+
import { type ArchiverDataStores } from './store/data_stores.js';
|
|
6
7
|
export declare const ARCHIVER_STORE_NAME = "archiver";
|
|
7
8
|
/** Creates an archiver store. */
|
|
8
|
-
export declare function createArchiverStore(userConfig: Pick<ArchiverConfig, 'archiverStoreMapSizeKb'
|
|
9
|
+
export declare function createArchiverStore(userConfig: Pick<ArchiverConfig, 'archiverStoreMapSizeKb'> & DataStoreConfig, genesisBlockHash: BlockHash): Promise<ArchiverDataStores>;
|
|
9
10
|
/**
|
|
10
11
|
* Creates a local archiver.
|
|
11
12
|
* @param config - The archiver configuration.
|
|
12
13
|
* @param deps - The archiver dependencies (blobClient, epochCache, dateProvider, telemetry).
|
|
13
14
|
* @param opts - The options.
|
|
15
|
+
* @param initialHeader - The genesis block header from world-state, used to answer block-0 queries.
|
|
16
|
+
* @param initialBlockHash - Precomputed hash of `initialHeader`. Hoisted to the caller so the archiver
|
|
17
|
+
* can expose `getGenesisBlockHash()` synchronously.
|
|
14
18
|
* @returns The local archiver.
|
|
15
19
|
*/
|
|
16
|
-
export declare function createArchiver(config: ArchiverConfig & DataStoreConfig, deps: ArchiverDeps, opts
|
|
20
|
+
export declare function createArchiver(config: ArchiverConfig & DataStoreConfig, deps: ArchiverDeps, opts: {
|
|
17
21
|
blockUntilSync: boolean;
|
|
18
|
-
}): Promise<Archiver>;
|
|
19
|
-
/** Registers protocol contracts in the archiver store. */
|
|
20
|
-
export declare function registerProtocolContracts(
|
|
21
|
-
|
|
22
|
+
} | undefined, initialHeader: BlockHeader, initialBlockHash: BlockHash): Promise<Archiver>;
|
|
23
|
+
/** Registers protocol contracts in the archiver store. Idempotent — skips contracts that already exist (e.g. on node restart). */
|
|
24
|
+
export declare function registerProtocolContracts(stores: ArchiverDataStores): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Preloads the standard contracts (AuthRegistry, PublicChecks, HandshakeRegistry) into the archiver store at block 0,
|
|
27
|
+
* mirroring {@link registerProtocolContracts}. Only invoked for test environments (via `testPreloadStandardContracts`),
|
|
28
|
+
* which also seed the matching registration/deployment nullifiers into the genesis nullifier tree so the store and tree
|
|
29
|
+
* stay consistent. Idempotent — skips contracts that already exist (e.g. on node restart).
|
|
30
|
+
*/
|
|
31
|
+
export declare function registerStandardContracts(stores: ArchiverDataStores): Promise<void>;
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2ZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBZ0JBLE9BQU8sS0FBSyxFQUFtQixTQUFTLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUd0RSxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUs5RCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQU1wRCxPQUFPLEVBQUUsUUFBUSxFQUFFLEtBQUssWUFBWSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQzVELE9BQU8sRUFBRSxLQUFLLGNBQWMsRUFBcUIsTUFBTSxhQUFhLENBQUM7QUFHckUsT0FBTyxFQUF1QixLQUFLLGtCQUFrQixFQUE0QixNQUFNLHdCQUF3QixDQUFDO0FBR2hILGVBQU8sTUFBTSxtQkFBbUIsYUFBYSxDQUFDO0FBRTlDLGlDQUFpQztBQUNqQyx3QkFBc0IsbUJBQW1CLENBQ3ZDLFVBQVUsRUFBRSxJQUFJLENBQUMsY0FBYyxFQUFFLHdCQUF3QixDQUFDLEdBQUcsZUFBZSxFQUM1RSxnQkFBZ0IsRUFBRSxTQUFTLEdBQzFCLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQU83QjtBQUVEOzs7Ozs7Ozs7R0FTRztBQUNILHdCQUFzQixjQUFjLENBQ2xDLE1BQU0sRUFBRSxjQUFjLEdBQUcsZUFBZSxFQUN4QyxJQUFJLEVBQUUsWUFBWSxFQUNsQixJQUFJOzthQUF3RCxFQUM1RCxhQUFhLEVBQUUsV0FBVyxFQUMxQixnQkFBZ0IsRUFBRSxTQUFTLEdBQzFCLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0F3SW5CO0FBRUQsb0lBQWtJO0FBQ2xJLHdCQUFzQix5QkFBeUIsQ0FBQyxNQUFNLEVBQUUsa0JBQWtCLGlCQXlCekU7QUFFRDs7Ozs7R0FLRztBQUNILHdCQUFzQix5QkFBeUIsQ0FBQyxNQUFNLEVBQUUsa0JBQWtCLGlCQXNCekUifQ==
|
package/dest/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAK9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAMpD,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,aAAa,CAAC;AAGrE,OAAO,EAAuB,KAAK,kBAAkB,EAA4B,MAAM,wBAAwB,CAAC;AAGhH,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C,iCAAiC;AACjC,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,IAAI,CAAC,cAAc,EAAE,wBAAwB,CAAC,GAAG,eAAe,EAC5E,gBAAgB,EAAE,SAAS,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CAO7B;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,cAAc,GAAG,eAAe,EACxC,IAAI,EAAE,YAAY,EAClB,IAAI;;aAAwD,EAC5D,aAAa,EAAE,WAAW,EAC1B,gBAAgB,EAAE,SAAS,GAC1B,OAAO,CAAC,QAAQ,CAAC,CAwInB;AAED,oIAAkI;AAClI,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,iBAyBzE;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,iBAsBzE"}
|
package/dest/factory.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
2
2
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
3
|
-
import {
|
|
3
|
+
import { makeL1HttpTransport } from '@aztec/ethereum/client';
|
|
4
|
+
import { InboxContract, OutboxContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
5
|
+
import { pickL1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
4
6
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
5
7
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
6
8
|
import { merge } from '@aztec/foundation/collection';
|
|
@@ -9,68 +11,78 @@ import { DateProvider } from '@aztec/foundation/timer';
|
|
|
9
11
|
import { createStore } from '@aztec/kv-store/lmdb-v2';
|
|
10
12
|
import { protocolContractNames } from '@aztec/protocol-contracts';
|
|
11
13
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
14
|
+
import { getPublishableStandardContracts } from '@aztec/standard-contracts';
|
|
12
15
|
import { FunctionType, decodeFunctionSignature } from '@aztec/stdlib/abi';
|
|
16
|
+
import { DEFAULT_BLOCK_DURATION_MS } from '@aztec/stdlib/config';
|
|
13
17
|
import { computePublicBytecodeCommitment } from '@aztec/stdlib/contract';
|
|
18
|
+
import { DEFAULT_ORPHAN_PRUNE_NO_PROPOSAL_TOLERANCE, getDefaultCheckpointProposalSyncGrace } from '@aztec/stdlib/timetable';
|
|
14
19
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
15
20
|
import { EventEmitter } from 'events';
|
|
16
|
-
import { createPublicClient
|
|
21
|
+
import { createPublicClient } from 'viem';
|
|
17
22
|
import { Archiver } from './archiver.js';
|
|
18
23
|
import { mapArchiverConfig } from './config.js';
|
|
19
24
|
import { ArchiverInstrumentation } from './modules/instrumentation.js';
|
|
20
25
|
import { ArchiverL1Synchronizer } from './modules/l1_synchronizer.js';
|
|
21
|
-
import { ARCHIVER_DB_VERSION,
|
|
26
|
+
import { ARCHIVER_DB_VERSION, createArchiverDataStores } from './store/data_stores.js';
|
|
22
27
|
import { L2TipsCache } from './store/l2_tips_cache.js';
|
|
23
28
|
export const ARCHIVER_STORE_NAME = 'archiver';
|
|
24
|
-
/** Creates an archiver store. */ export async function createArchiverStore(userConfig,
|
|
29
|
+
/** Creates an archiver store. */ export async function createArchiverStore(userConfig, genesisBlockHash) {
|
|
25
30
|
const config = {
|
|
26
31
|
...userConfig,
|
|
27
32
|
dataStoreMapSizeKb: userConfig.archiverStoreMapSizeKb ?? userConfig.dataStoreMapSizeKb
|
|
28
33
|
};
|
|
29
34
|
const store = await createStore(ARCHIVER_STORE_NAME, ARCHIVER_DB_VERSION, config);
|
|
30
|
-
return
|
|
35
|
+
return createArchiverDataStores(store, genesisBlockHash);
|
|
31
36
|
}
|
|
32
37
|
/**
|
|
33
38
|
* Creates a local archiver.
|
|
34
39
|
* @param config - The archiver configuration.
|
|
35
40
|
* @param deps - The archiver dependencies (blobClient, epochCache, dateProvider, telemetry).
|
|
36
41
|
* @param opts - The options.
|
|
42
|
+
* @param initialHeader - The genesis block header from world-state, used to answer block-0 queries.
|
|
43
|
+
* @param initialBlockHash - Precomputed hash of `initialHeader`. Hoisted to the caller so the archiver
|
|
44
|
+
* can expose `getGenesisBlockHash()` synchronously.
|
|
37
45
|
* @returns The local archiver.
|
|
38
46
|
*/ export async function createArchiver(config, deps, opts = {
|
|
39
47
|
blockUntilSync: true
|
|
40
|
-
}) {
|
|
41
|
-
const archiverStore = await createArchiverStore(config,
|
|
42
|
-
epochDuration: config.aztecEpochDuration
|
|
43
|
-
});
|
|
48
|
+
}, initialHeader, initialBlockHash) {
|
|
49
|
+
const archiverStore = await createArchiverStore(config, initialBlockHash);
|
|
44
50
|
await registerProtocolContracts(archiverStore);
|
|
51
|
+
if (config.testPreloadStandardContracts) {
|
|
52
|
+
await registerStandardContracts(archiverStore);
|
|
53
|
+
}
|
|
45
54
|
// Create Ethereum clients
|
|
46
55
|
const chain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
|
|
56
|
+
const httpTimeout = config.l1HttpTimeoutMS;
|
|
47
57
|
const publicClient = createPublicClient({
|
|
48
58
|
chain: chain.chainInfo,
|
|
49
|
-
transport:
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
transport: makeL1HttpTransport(config.l1RpcUrls, {
|
|
60
|
+
timeout: httpTimeout
|
|
61
|
+
}),
|
|
52
62
|
pollingInterval: config.viemPollingIntervalMS
|
|
53
63
|
});
|
|
54
64
|
// Create debug client using debug RPC URLs if available, otherwise fall back to regular RPC URLs
|
|
55
65
|
const debugRpcUrls = config.l1DebugRpcUrls.length > 0 ? config.l1DebugRpcUrls : config.l1RpcUrls;
|
|
56
66
|
const debugClient = createPublicClient({
|
|
57
67
|
chain: chain.chainInfo,
|
|
58
|
-
transport:
|
|
59
|
-
|
|
60
|
-
|
|
68
|
+
transport: makeL1HttpTransport(debugRpcUrls, {
|
|
69
|
+
timeout: httpTimeout
|
|
70
|
+
}),
|
|
61
71
|
pollingInterval: config.viemPollingIntervalMS
|
|
62
72
|
});
|
|
63
73
|
// Create L1 contract instances
|
|
64
|
-
const rollup = new RollupContract(publicClient, config.
|
|
65
|
-
const inbox = new InboxContract(publicClient, config.
|
|
74
|
+
const rollup = new RollupContract(publicClient, config.rollupAddress);
|
|
75
|
+
const inbox = new InboxContract(publicClient, config.inboxAddress);
|
|
76
|
+
const outbox = new OutboxContract(publicClient, config.outboxAddress);
|
|
66
77
|
// Fetch L1 constants from rollup contract
|
|
67
|
-
const [l1StartBlock, l1GenesisTime, proofSubmissionEpochs, genesisArchiveRoot, slashingProposerAddress, targetCommitteeSize] = await Promise.all([
|
|
78
|
+
const [l1StartBlock, l1GenesisTime, proofSubmissionEpochs, genesisArchiveRoot, slashingProposerAddress, targetCommitteeSize, rollupManaLimit] = await Promise.all([
|
|
68
79
|
rollup.getL1StartBlock(),
|
|
69
80
|
rollup.getL1GenesisTime(),
|
|
70
81
|
rollup.getProofSubmissionEpochs(),
|
|
71
82
|
rollup.getGenesisArchiveTreeRoot(),
|
|
72
83
|
rollup.getSlashingProposerAddress(),
|
|
73
|
-
rollup.getTargetCommitteeSize()
|
|
84
|
+
rollup.getTargetCommitteeSize(),
|
|
85
|
+
rollup.getManaLimit()
|
|
74
86
|
]);
|
|
75
87
|
const l1StartBlockHash = await publicClient.getBlock({
|
|
76
88
|
blockNumber: l1StartBlock,
|
|
@@ -86,49 +98,85 @@ export const ARCHIVER_STORE_NAME = 'archiver';
|
|
|
86
98
|
ethereumSlotDuration,
|
|
87
99
|
proofSubmissionEpochs: Number(proofSubmissionEpochs),
|
|
88
100
|
targetCommitteeSize,
|
|
89
|
-
genesisArchiveRoot: Fr.fromString(genesisArchiveRoot.toString())
|
|
101
|
+
genesisArchiveRoot: Fr.fromString(genesisArchiveRoot.toString()),
|
|
102
|
+
rollupManaLimit: Number(rollupManaLimit)
|
|
90
103
|
};
|
|
91
104
|
const archiverConfig = merge({
|
|
92
105
|
pollingIntervalMs: 10_000,
|
|
93
106
|
batchSize: 100,
|
|
94
107
|
maxAllowedEthClientDriftSeconds: 300,
|
|
95
|
-
ethereumAllowNoDebugHosts: false
|
|
108
|
+
ethereumAllowNoDebugHosts: false,
|
|
109
|
+
skipHistoricalLogsCheck: false,
|
|
110
|
+
checkpointProposalSyncGrace: config.checkpointProposalSyncGraceSeconds ?? getDefaultCheckpointProposalSyncGrace((config.blockDurationMs ?? DEFAULT_BLOCK_DURATION_MS) / 1000),
|
|
111
|
+
orphanPruneNoProposalTolerance: DEFAULT_ORPHAN_PRUNE_NO_PROPOSAL_TOLERANCE,
|
|
112
|
+
skipOrphanProposedBlockPruning: false,
|
|
113
|
+
blockDuration: (config.blockDurationMs ?? DEFAULT_BLOCK_DURATION_MS) / 1000
|
|
96
114
|
}, mapArchiverConfig(config));
|
|
97
|
-
const epochCache = deps.epochCache ?? await EpochCache.create(config.
|
|
115
|
+
const epochCache = deps.epochCache ?? await EpochCache.create(config.rollupAddress, config, deps);
|
|
98
116
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
99
|
-
const instrumentation = await ArchiverInstrumentation.new(telemetry, ()=>archiverStore.estimateSize());
|
|
117
|
+
const instrumentation = await ArchiverInstrumentation.new(telemetry, ()=>archiverStore.db.estimateSize());
|
|
100
118
|
// Create the event emitter that will be shared by archiver and synchronizer
|
|
101
119
|
const events = new EventEmitter();
|
|
102
|
-
// Create L2 tips cache shared by archiver and synchronizer
|
|
103
|
-
|
|
120
|
+
// Create L2 tips cache shared by archiver and synchronizer. The genesis block hash is dynamic —
|
|
121
|
+
// it depends on the injected initial header (genesisTimestamp + prefilled state). Hoisted to the
|
|
122
|
+
// caller so we can pass the same value to the archiver and expose it via `getGenesisBlockHash()`.
|
|
123
|
+
const l2TipsCache = new L2TipsCache(archiverStore.blocks, initialBlockHash);
|
|
104
124
|
// Create the L1 synchronizer
|
|
105
125
|
const synchronizer = new ArchiverL1Synchronizer(publicClient, debugClient, rollup, inbox, archiverStore, archiverConfig, deps.blobClient, epochCache, deps.dateProvider ?? new DateProvider(), instrumentation, l1Constants, events, instrumentation.tracer, l2TipsCache, undefined);
|
|
106
|
-
const archiver = new Archiver(publicClient, debugClient, rollup, {
|
|
107
|
-
...config
|
|
126
|
+
const archiver = new Archiver(publicClient, debugClient, rollup, outbox, {
|
|
127
|
+
...pickL1ContractAddresses(config),
|
|
108
128
|
slashingProposerAddress
|
|
109
|
-
}, archiverStore, archiverConfig, deps.blobClient, instrumentation, l1Constants, synchronizer, events, l2TipsCache);
|
|
129
|
+
}, archiverStore, archiverConfig, deps.blobClient, instrumentation, l1Constants, synchronizer, events, initialHeader, initialBlockHash, l2TipsCache, deps.dateProvider ?? new DateProvider());
|
|
110
130
|
await archiver.start(opts.blockUntilSync);
|
|
111
131
|
return archiver;
|
|
112
132
|
}
|
|
113
|
-
/** Registers protocol contracts in the archiver store. */ export async function registerProtocolContracts(
|
|
133
|
+
/** Registers protocol contracts in the archiver store. Idempotent — skips contracts that already exist (e.g. on node restart). */ export async function registerProtocolContracts(stores) {
|
|
114
134
|
const blockNumber = 0;
|
|
115
135
|
for (const name of protocolContractNames){
|
|
116
136
|
const provider = new BundledProtocolContractsProvider();
|
|
117
137
|
const contract = await provider.getProtocolContractArtifact(name);
|
|
138
|
+
// Skip if already registered (happens on node restart with a persisted store).
|
|
139
|
+
if (await stores.contractClasses.getContractClass(contract.contractClass.id)) {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const publicBytecodeCommitment = await computePublicBytecodeCommitment(contract.contractClass.packedBytecode);
|
|
143
|
+
const contractClassPublic = {
|
|
144
|
+
...contract.contractClass,
|
|
145
|
+
publicBytecodeCommitment
|
|
146
|
+
};
|
|
147
|
+
const publicFunctionSignatures = contract.artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
148
|
+
await stores.functionNames.register(publicFunctionSignatures);
|
|
149
|
+
await stores.contractClasses.addContractClasses([
|
|
150
|
+
contractClassPublic
|
|
151
|
+
], BlockNumber(blockNumber));
|
|
152
|
+
await stores.contractInstances.addContractInstances([
|
|
153
|
+
contract.instance
|
|
154
|
+
], BlockNumber(blockNumber));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Preloads the standard contracts (AuthRegistry, PublicChecks, HandshakeRegistry) into the archiver store at block 0,
|
|
159
|
+
* mirroring {@link registerProtocolContracts}. Only invoked for test environments (via `testPreloadStandardContracts`),
|
|
160
|
+
* which also seed the matching registration/deployment nullifiers into the genesis nullifier tree so the store and tree
|
|
161
|
+
* stay consistent. Idempotent — skips contracts that already exist (e.g. on node restart).
|
|
162
|
+
*/ export async function registerStandardContracts(stores) {
|
|
163
|
+
const blockNumber = 0;
|
|
164
|
+
for (const contract of (await getPublishableStandardContracts())){
|
|
165
|
+
// Skip if already registered (happens on node restart with a persisted store).
|
|
166
|
+
if (await stores.contractClasses.getContractClass(contract.contractClass.id)) {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
const publicBytecodeCommitment = await computePublicBytecodeCommitment(contract.contractClass.packedBytecode);
|
|
118
170
|
const contractClassPublic = {
|
|
119
171
|
...contract.contractClass,
|
|
120
|
-
|
|
121
|
-
utilityFunctions: []
|
|
172
|
+
publicBytecodeCommitment
|
|
122
173
|
};
|
|
123
174
|
const publicFunctionSignatures = contract.artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
124
|
-
await
|
|
125
|
-
|
|
126
|
-
await store.addContractClasses([
|
|
175
|
+
await stores.functionNames.register(publicFunctionSignatures);
|
|
176
|
+
await stores.contractClasses.addContractClasses([
|
|
127
177
|
contractClassPublic
|
|
128
|
-
], [
|
|
129
|
-
bytecodeCommitment
|
|
130
178
|
], BlockNumber(blockNumber));
|
|
131
|
-
await
|
|
179
|
+
await stores.contractInstances.addContractInstances([
|
|
132
180
|
contract.instance
|
|
133
181
|
], BlockNumber(blockNumber));
|
|
134
182
|
}
|