@aztec/archiver 0.0.1-commit.2b2662070 → 0.0.1-commit.2c0ee1788
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.d.ts +17 -10
- package/dest/archiver.d.ts.map +1 -1
- package/dest/archiver.js +92 -53
- package/dest/config.d.ts +3 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +14 -3
- package/dest/errors.d.ts +32 -5
- package/dest/errors.d.ts.map +1 -1
- package/dest/errors.js +51 -6
- package/dest/factory.d.ts +4 -4
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +13 -10
- package/dest/index.d.ts +10 -3
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +9 -2
- package/dest/l1/calldata_retriever.d.ts +2 -1
- package/dest/l1/calldata_retriever.d.ts.map +1 -1
- package/dest/l1/calldata_retriever.js +9 -4
- package/dest/l1/data_retrieval.d.ts +18 -9
- package/dest/l1/data_retrieval.d.ts.map +1 -1
- package/dest/l1/data_retrieval.js +13 -19
- 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 +42 -0
- package/dest/modules/data_source_base.d.ts +16 -10
- package/dest/modules/data_source_base.d.ts.map +1 -1
- package/dest/modules/data_source_base.js +71 -60
- package/dest/modules/data_store_updater.d.ts +16 -9
- package/dest/modules/data_store_updater.d.ts.map +1 -1
- package/dest/modules/data_store_updater.js +52 -40
- package/dest/modules/instrumentation.d.ts +4 -1
- package/dest/modules/instrumentation.d.ts.map +1 -1
- package/dest/modules/instrumentation.js +5 -0
- package/dest/modules/l1_synchronizer.d.ts +8 -4
- package/dest/modules/l1_synchronizer.d.ts.map +1 -1
- package/dest/modules/l1_synchronizer.js +182 -70
- package/dest/modules/validation.d.ts +4 -3
- package/dest/modules/validation.d.ts.map +1 -1
- package/dest/modules/validation.js +4 -4
- package/dest/store/block_store.d.ts +59 -21
- package/dest/store/block_store.d.ts.map +1 -1
- package/dest/store/block_store.js +181 -66
- package/dest/store/contract_class_store.d.ts +17 -3
- package/dest/store/contract_class_store.d.ts.map +1 -1
- package/dest/store/contract_class_store.js +17 -1
- 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 +31 -0
- 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 +50 -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.js +1 -1
- package/dest/test/fake_l1_state.d.ts +7 -3
- package/dest/test/fake_l1_state.d.ts.map +1 -1
- package/dest/test/fake_l1_state.js +42 -15
- package/dest/test/mock_l2_block_source.d.ts +12 -3
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +24 -2
- package/dest/test/noop_l1_archiver.d.ts +4 -4
- package/dest/test/noop_l1_archiver.d.ts.map +1 -1
- package/dest/test/noop_l1_archiver.js +9 -6
- package/package.json +13 -13
- package/src/archiver.ts +108 -50
- package/src/config.ts +15 -1
- package/src/errors.ts +75 -8
- package/src/factory.ts +11 -10
- package/src/index.ts +17 -2
- package/src/l1/calldata_retriever.ts +15 -4
- package/src/l1/data_retrieval.ts +30 -35
- package/src/l1/validate_historical_logs.ts +140 -0
- package/src/modules/contract_data_source_adapter.ts +59 -0
- package/src/modules/data_source_base.ts +75 -57
- package/src/modules/data_store_updater.ts +71 -39
- package/src/modules/instrumentation.ts +8 -0
- package/src/modules/l1_synchronizer.ts +241 -71
- package/src/modules/validation.ts +8 -7
- package/src/store/block_store.ts +204 -73
- package/src/store/contract_class_store.ts +28 -2
- package/src/store/contract_instance_store.ts +43 -0
- package/src/store/data_stores.ts +108 -0
- package/src/store/function_names_cache.ts +37 -0
- package/src/store/l2_tips_cache.ts +1 -1
- package/src/test/fake_l1_state.ts +47 -24
- package/src/test/mock_l2_block_source.ts +23 -2
- package/src/test/noop_l1_archiver.ts +9 -6
- package/dest/store/kv_archiver_store.d.ts +0 -377
- package/dest/store/kv_archiver_store.d.ts.map +0 -1
- package/dest/store/kv_archiver_store.js +0 -494
- package/src/store/kv_archiver_store.ts +0 -713
|
@@ -5,15 +5,15 @@ import { ConsensusPayload } from '@aztec/stdlib/p2p';
|
|
|
5
5
|
/**
|
|
6
6
|
* Extracts attestation information from a published checkpoint.
|
|
7
7
|
* Returns info for each attestation, preserving array indices.
|
|
8
|
-
*/ export function getAttestationInfoFromPublishedCheckpoint({ checkpoint, attestations }) {
|
|
9
|
-
const payload = ConsensusPayload.fromCheckpoint(checkpoint);
|
|
8
|
+
*/ export function getAttestationInfoFromPublishedCheckpoint({ checkpoint, attestations }, signatureContext) {
|
|
9
|
+
const payload = ConsensusPayload.fromCheckpoint(checkpoint, signatureContext);
|
|
10
10
|
return getAttestationInfoFromPayload(payload, attestations);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Validates the attestations submitted for the given checkpoint.
|
|
14
14
|
* Returns true if the attestations are valid and sufficient, false otherwise.
|
|
15
|
-
*/ export async function validateCheckpointAttestations(publishedCheckpoint, epochCache, constants, logger) {
|
|
16
|
-
const attestorInfos = getAttestationInfoFromPublishedCheckpoint(publishedCheckpoint);
|
|
15
|
+
*/ export async function validateCheckpointAttestations(publishedCheckpoint, epochCache, constants, signatureContext, logger) {
|
|
16
|
+
const attestorInfos = getAttestationInfoFromPublishedCheckpoint(publishedCheckpoint, signatureContext);
|
|
17
17
|
const attestors = compactArray(attestorInfos.map((info)=>'address' in info ? info.address : undefined));
|
|
18
18
|
const { checkpoint, attestations } = publishedCheckpoint;
|
|
19
19
|
const headerHash = checkpoint.header.hash();
|
|
@@ -2,8 +2,8 @@ import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/bra
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import { type BlockData, BlockHash, CheckpointedL2Block, L2Block, type ValidateCheckpointResult } from '@aztec/stdlib/block';
|
|
6
|
-
import { type CheckpointData, type CommonCheckpointData, type ProposedCheckpointData, type ProposedCheckpointInput, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
5
|
+
import { type BlockData, type BlockDataWithCheckpointContext, BlockHash, CheckpointedL2Block, CommitteeAttestation, L2Block, type ValidateCheckpointResult } from '@aztec/stdlib/block';
|
|
6
|
+
import { type CheckpointData, type CommonCheckpointData, L1PublishedData, type ProposedCheckpointData, type ProposedCheckpointInput, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
7
7
|
import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
8
8
|
import { BlockHeader, type IndexedTxEffect, TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
9
9
|
export { TxReceipt, type TxEffect, type TxHash } from '@aztec/stdlib/tx';
|
|
@@ -46,7 +46,7 @@ export declare class BlockStore {
|
|
|
46
46
|
/**
|
|
47
47
|
* Validates that blocks are sequential, have correct indexes, and chain via archive roots.
|
|
48
48
|
* This is the same validation used for both confirmed checkpoints (addCheckpoints) and
|
|
49
|
-
* proposed checkpoints (
|
|
49
|
+
* proposed checkpoints (addProposedCheckpoint).
|
|
50
50
|
*/
|
|
51
51
|
private validateCheckpointBlocks;
|
|
52
52
|
private addBlockToDatabase;
|
|
@@ -80,19 +80,39 @@ export declare class BlockStore {
|
|
|
80
80
|
getProvenBlockNumber(): Promise<BlockNumber>;
|
|
81
81
|
getLatestCheckpointNumber(): Promise<CheckpointNumber>;
|
|
82
82
|
hasProposedCheckpoint(): Promise<boolean>;
|
|
83
|
-
/** Deletes
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
*
|
|
91
|
-
*
|
|
83
|
+
/** Deletes all pending proposed checkpoints from storage. */
|
|
84
|
+
deleteProposedCheckpoints(): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Promotes a specific pending checkpoint to a confirmed checkpoint entry.
|
|
87
|
+
* This persists the checkpoint to the store, removes only that pending entry, and updates the L1 sync point.
|
|
88
|
+
* Remaining pending entries (e.g. N+1, N+2) are left intact — they chain off the just-promoted one.
|
|
89
|
+
* @param checkpointNumber - The checkpoint number to promote.
|
|
90
|
+
* @param l1 - L1 published data for the checkpoint.
|
|
91
|
+
* @param attestations - Committee attestations.
|
|
92
|
+
* @param expectedArchiveRoot - Archive root guard against races.
|
|
93
|
+
*/
|
|
94
|
+
promoteProposedToCheckpointed(checkpointNumber: CheckpointNumber, l1: L1PublishedData, attestations: CommitteeAttestation[], expectedArchiveRoot: Fr): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Returns the latest pending checkpoint (highest-numbered entry), or undefined if none.
|
|
97
|
+
* No fallback to confirmed.
|
|
98
|
+
*/
|
|
99
|
+
getLastProposedCheckpoint(): Promise<ProposedCheckpointData | undefined>;
|
|
100
|
+
/** Returns the pending checkpoint for a specific checkpoint number, or undefined if not found. */
|
|
101
|
+
getProposedCheckpointByNumber(n: CheckpointNumber): Promise<ProposedCheckpointData | undefined>;
|
|
102
|
+
/** Returns all pending checkpoints in ascending checkpoint-number order. */
|
|
103
|
+
getProposedCheckpoints(): Promise<ProposedCheckpointData[]>;
|
|
104
|
+
/**
|
|
105
|
+
* Evicts all pending checkpoints with checkpoint number >= fromNumber.
|
|
106
|
+
* Used for divergent-mined-checkpoint cleanup: when L1 mines checkpoint N with a different archive,
|
|
107
|
+
* all pending >= N must be evicted since they chain off the now-invalid pending N.
|
|
108
|
+
*/
|
|
109
|
+
evictProposedCheckpointsFrom(fromNumber: CheckpointNumber): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Gets the checkpoint at the proposed tip:
|
|
112
|
+
* - latest pending checkpoint if any exist
|
|
92
113
|
* - fallsback to latest confirmed checkpoint otherwise
|
|
93
|
-
* @returns CommonCheckpointData
|
|
94
114
|
*/
|
|
95
|
-
|
|
115
|
+
getLastCheckpoint(): Promise<CommonCheckpointData | undefined>;
|
|
96
116
|
private convertToProposedCheckpointData;
|
|
97
117
|
/**
|
|
98
118
|
* Attempts to get the proposedCheckpoint's number, if there is not one, then fallback to the latest confirmed checkpoint number.
|
|
@@ -111,7 +131,9 @@ export declare class BlockStore {
|
|
|
111
131
|
* @param limit - The number of blocks to return.
|
|
112
132
|
* @returns The requested L2 blocks
|
|
113
133
|
*/
|
|
114
|
-
getCheckpointedBlocks(start: BlockNumber, limit: number):
|
|
134
|
+
getCheckpointedBlocks(start: BlockNumber, limit: number): Promise<CheckpointedL2Block[]>;
|
|
135
|
+
/** Async iterator variant of {@link getCheckpointedBlocks}. */
|
|
136
|
+
iterateCheckpointedBlocks(start: BlockNumber, limit: number): AsyncIterableIterator<CheckpointedL2Block>;
|
|
115
137
|
getCheckpointedBlockByHash(blockHash: BlockHash): Promise<CheckpointedL2Block | undefined>;
|
|
116
138
|
getCheckpointedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined>;
|
|
117
139
|
/**
|
|
@@ -120,13 +142,23 @@ export declare class BlockStore {
|
|
|
120
142
|
* @param limit - The number of blocks to return.
|
|
121
143
|
* @returns The requested L2 blocks
|
|
122
144
|
*/
|
|
123
|
-
getBlocks(start: BlockNumber, limit: number):
|
|
145
|
+
getBlocks(start: BlockNumber, limit: number): Promise<L2Block[]>;
|
|
146
|
+
/** Async iterator variant of {@link getBlocks}. */
|
|
147
|
+
iterateBlocks(start: BlockNumber, limit: number): AsyncIterableIterator<L2Block>;
|
|
124
148
|
/**
|
|
125
149
|
* Gets block metadata (without tx data) by block number.
|
|
126
150
|
* @param blockNumber - The number of the block to return.
|
|
127
151
|
* @returns The requested block data.
|
|
128
152
|
*/
|
|
129
153
|
getBlockData(blockNumber: BlockNumber): Promise<BlockData | undefined>;
|
|
154
|
+
/**
|
|
155
|
+
* Gets block metadata plus checkpoint-derived context (L1 publish info, attestations) without
|
|
156
|
+
* deserializing tx bodies. When the block's containing checkpoint has not yet been L1-confirmed,
|
|
157
|
+
* `checkpoint` and `l1` are `undefined` and `attestations` is empty.
|
|
158
|
+
*/
|
|
159
|
+
getBlockDataWithCheckpointContext(blockNumber: BlockNumber): Promise<BlockDataWithCheckpointContext | undefined>;
|
|
160
|
+
/** Returns the checkpoint number that contains the given slot (or undefined if not found). */
|
|
161
|
+
getCheckpointNumberBySlot(slot: SlotNumber): Promise<CheckpointNumber | undefined>;
|
|
130
162
|
/**
|
|
131
163
|
* Gets block metadata (without tx data) by archive root.
|
|
132
164
|
* @param archive - The archive root of the block to return.
|
|
@@ -169,7 +201,9 @@ export declare class BlockStore {
|
|
|
169
201
|
* @param limit - The number of blocks to return.
|
|
170
202
|
* @returns The requested L2 block headers
|
|
171
203
|
*/
|
|
172
|
-
getBlockHeaders(start: BlockNumber, limit: number):
|
|
204
|
+
getBlockHeaders(start: BlockNumber, limit: number): Promise<BlockHeader[]>;
|
|
205
|
+
/** Async iterator variant of {@link getBlockHeaders}. */
|
|
206
|
+
iterateBlockHeaders(start: BlockNumber, limit: number): AsyncIterableIterator<BlockHeader>;
|
|
173
207
|
private getBlockStorages;
|
|
174
208
|
private getBlockDataFromBlockStorage;
|
|
175
209
|
private getBlockFromBlockStorage;
|
|
@@ -209,9 +243,13 @@ export declare class BlockStore {
|
|
|
209
243
|
*/
|
|
210
244
|
getSynchedL1BlockNumber(): Promise<bigint | undefined>;
|
|
211
245
|
setSynchedL1BlockNumber(l1BlockNumber: bigint): Promise<boolean>;
|
|
212
|
-
/**
|
|
213
|
-
*
|
|
214
|
-
|
|
246
|
+
/**
|
|
247
|
+
* Adds a proposed checkpoint to the pending queue.
|
|
248
|
+
* Accepts proposed.checkpointNumber === latestTip + 1, where latestTip is the highest of
|
|
249
|
+
* confirmed and the highest pending checkpoint number.
|
|
250
|
+
* Computes archive and checkpointOutHash from the stored blocks.
|
|
251
|
+
*/
|
|
252
|
+
addProposedCheckpoint(proposed: ProposedCheckpointInput): Promise<void>;
|
|
215
253
|
getProvenCheckpointNumber(): Promise<CheckpointNumber>;
|
|
216
254
|
setProvenCheckpointNumber(checkpointNumber: CheckpointNumber): Promise<boolean>;
|
|
217
255
|
getFinalizedCheckpointNumber(): Promise<CheckpointNumber>;
|
|
@@ -227,4 +265,4 @@ export declare class BlockStore {
|
|
|
227
265
|
*/
|
|
228
266
|
setPendingChainValidationStatus(status: ValidateCheckpointResult | undefined): Promise<void>;
|
|
229
267
|
}
|
|
230
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
268
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdG9yZS9ibG9ja19zdG9yZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsV0FBVyxFQUFFLGdCQUFnQixFQUF5QixVQUFVLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuSCxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFNcEQsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQTZDLE1BQU0saUJBQWlCLENBQUM7QUFDcEcsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxFQUNMLEtBQUssU0FBUyxFQUNkLEtBQUssOEJBQThCLEVBQ25DLFNBQVMsRUFFVCxtQkFBbUIsR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1QkFBdUIsSUFBSSxPQUFPLENBQUMsTUFBTSxHQUFHLFNBQVMsQ0FBQyxDQUVyRDtJQUVELHVCQUF1QixDQUFDLGFBQWEsRUFBRSxNQUFNLG9CQUU1QztJQUVEOzs7OztPQUtHO0lBQ0cscUJBQXFCLENBQUMsUUFBUSxFQUFFLHVCQUF1QixpQkFzQzVEO0lBRUsseUJBQXlCLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBUTNEO0lBRUsseUJBQXlCLENBQUMsZ0JBQWdCLEVBQUUsZ0JBQWdCLG9CQUdqRTtJQUVLLDRCQUE0QixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQVE5RDtJQUVELDRCQUE0QixDQUFDLGdCQUFnQixFQUFFLGdCQUFnQixvQkFFOUQ7SUFjRDs7O09BR0c7SUFDRywrQkFBK0IsSUFBSSxPQUFPLENBQUMsd0JBQXdCLEdBQUcsU0FBUyxDQUFDLENBTXJGO0lBRUQ7OztPQUdHO0lBQ0csK0JBQStCLENBQUMsTUFBTSxFQUFFLHdCQUF3QixHQUFHLFNBQVMsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBT2pHO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_store.d.ts","sourceRoot":"","sources":["../../src/store/block_store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAyB,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACnH,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAMpD,OAAO,KAAK,EAAE,iBAAiB,EAA6C,MAAM,iBAAiB,CAAC;AACpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,KAAK,SAAS,EACd,SAAS,EAET,mBAAmB,
|
|
1
|
+
{"version":3,"file":"block_store.d.ts","sourceRoot":"","sources":["../../src/store/block_store.ts"],"names":[],"mappings":"AAC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4BAA4B,CAAC,gBAAgB,EAAE,gBAAgB,oBAE9D;IAcD;;;OAGG;IACG,+BAA+B,IAAI,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAMrF;IAED;;;OAGG;IACG,+BAA+B,CAAC,MAAM,EAAE,wBAAwB,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAOjG;CACF"}
|
|
@@ -12,14 +12,15 @@ import { getEpochAtSlot } from '@aztec/stdlib/epoch-helpers';
|
|
|
12
12
|
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
13
13
|
import { AppendOnlyTreeSnapshot } from '@aztec/stdlib/trees';
|
|
14
14
|
import { BlockHeader, TxHash, TxReceipt, TxStatus, deserializeIndexedTxEffect, serializeIndexedTxEffect } from '@aztec/stdlib/tx';
|
|
15
|
-
import { BlockAlreadyCheckpointedError, BlockArchiveNotConsistentError, BlockIndexNotSequentialError, BlockNotFoundError, BlockNumberNotSequentialError, CannotOverwriteCheckpointedBlockError, CheckpointNotFoundError, CheckpointNumberNotSequentialError, InitialCheckpointNumberNotSequentialError, ProposedCheckpointNotSequentialError,
|
|
15
|
+
import { BlockAlreadyCheckpointedError, BlockArchiveNotConsistentError, BlockCheckpointNumberNotSequentialError, BlockIndexNotSequentialError, BlockNotFoundError, BlockNumberNotSequentialError, CannotOverwriteCheckpointedBlockError, CheckpointNotFoundError, CheckpointNumberNotSequentialError, InitialCheckpointNumberNotSequentialError, NoProposedCheckpointToPromoteError, ProposedCheckpointArchiveRootMismatchError, ProposedCheckpointNotSequentialError, ProposedCheckpointPromotionNotSequentialError } from '../errors.js';
|
|
16
16
|
export { TxReceipt } from '@aztec/stdlib/tx';
|
|
17
17
|
/**
|
|
18
18
|
* LMDB-based block storage for the archiver.
|
|
19
19
|
*/ export class BlockStore {
|
|
20
20
|
db;
|
|
21
21
|
/** Map block number to block data */ #blocks;
|
|
22
|
-
/** Map checkpoint number
|
|
22
|
+
/** Map keyed by checkpoint number holding proposed (locally-validated, not yet L1-confirmed) checkpoints. */ #proposedCheckpoints;
|
|
23
|
+
/** Map checkpoint number to checkpoint data for mined checkpoints only */ #checkpoints;
|
|
23
24
|
/** Map slot number to checkpoint number, for looking up checkpoints by slot range. */ #slotToCheckpoint;
|
|
24
25
|
/** Map block hash to list of tx hashes */ #blockTxs;
|
|
25
26
|
/** Tx hash to serialized IndexedTxEffect */ #txEffects;
|
|
@@ -30,7 +31,6 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
30
31
|
/** Index mapping a contract's address (as a string) to its location in a block */ #contractIndex;
|
|
31
32
|
/** Index mapping block hash to block number */ #blockHashIndex;
|
|
32
33
|
/** Index mapping block archive to block number */ #blockArchiveIndex;
|
|
33
|
-
/** Singleton: assumes max 1-deep pipeline. For deeper pipelining, replace with a map keyed by checkpoint number. */ #proposedCheckpoint;
|
|
34
34
|
#log;
|
|
35
35
|
constructor(db){
|
|
36
36
|
this.db = db;
|
|
@@ -47,7 +47,7 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
47
47
|
this.#pendingChainValidationStatus = db.openSingleton('archiver_pending_chain_validation_status');
|
|
48
48
|
this.#checkpoints = db.openMap('archiver_checkpoints');
|
|
49
49
|
this.#slotToCheckpoint = db.openMap('archiver_slot_to_checkpoint');
|
|
50
|
-
this.#
|
|
50
|
+
this.#proposedCheckpoints = db.openMap('archiver_proposed_checkpoints');
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Returns the finalized L2 block number. An L2 block is finalized when it was proven
|
|
@@ -78,8 +78,7 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
78
78
|
const blockLastArchive = block.header.lastArchive.root;
|
|
79
79
|
// Extract the latest block and checkpoint numbers
|
|
80
80
|
const previousBlockNumber = await this.getLatestL2BlockNumber();
|
|
81
|
-
const
|
|
82
|
-
const previousCheckpointNumber = await this.getLatestCheckpointNumber();
|
|
81
|
+
const latestCheckpointNumber = await this.getLatestCheckpointNumber();
|
|
83
82
|
// Verify we're not overwriting checkpointed blocks
|
|
84
83
|
const lastCheckpointedBlockNumber = await this.getCheckpointedL2BlockNumber();
|
|
85
84
|
if (!opts.force && blockNumber <= lastCheckpointedBlockNumber) {
|
|
@@ -94,18 +93,17 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
94
93
|
if (!opts.force && previousBlockNumber !== blockNumber - 1) {
|
|
95
94
|
throw new BlockNumberNotSequentialError(blockNumber, previousBlockNumber);
|
|
96
95
|
}
|
|
97
|
-
//
|
|
98
|
-
//
|
|
96
|
+
// Accept the block if either the confirmed checkpoint or a pending checkpoint matches
|
|
97
|
+
// the expected predecessor. We look for a pending entry at exactly blockCheckpointNumber - 1.
|
|
99
98
|
const expectedCheckpointNumber = blockCheckpointNumber - 1;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
throw new CheckpointNumberNotSequentialError(blockCheckpointNumber, reported, source);
|
|
99
|
+
const hasPendingAtExpected = await this.#proposedCheckpoints.hasAsync(expectedCheckpointNumber);
|
|
100
|
+
if (!opts.force && latestCheckpointNumber !== expectedCheckpointNumber && !hasPendingAtExpected) {
|
|
101
|
+
const [latestPendingKey] = await toArray(this.#proposedCheckpoints.keysAsync({
|
|
102
|
+
reverse: true,
|
|
103
|
+
limit: 1
|
|
104
|
+
}));
|
|
105
|
+
const previous = CheckpointNumber(Math.max(latestCheckpointNumber, latestPendingKey ?? 0));
|
|
106
|
+
throw new BlockCheckpointNumberNotSequentialError(blockNumber, blockCheckpointNumber, previous);
|
|
109
107
|
}
|
|
110
108
|
// Extract the previous block if there is one and see if it is for the same checkpoint or not
|
|
111
109
|
const previousBlockResult = await this.getBlock(previousBlockNumber);
|
|
@@ -181,14 +179,14 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
181
179
|
attestations: checkpoint.attestations.map((attestation)=>attestation.toBuffer()),
|
|
182
180
|
checkpointNumber: checkpoint.checkpoint.number,
|
|
183
181
|
startBlock: checkpoint.checkpoint.blocks[0].number,
|
|
184
|
-
blockCount: checkpoint.checkpoint.blocks.length
|
|
182
|
+
blockCount: checkpoint.checkpoint.blocks.length,
|
|
183
|
+
feeAssetPriceModifier: checkpoint.checkpoint.feeAssetPriceModifier.toString()
|
|
185
184
|
});
|
|
186
185
|
// Update slot-to-checkpoint index
|
|
187
186
|
await this.#slotToCheckpoint.set(checkpoint.checkpoint.header.slotNumber, checkpoint.checkpoint.number);
|
|
187
|
+
// Remove proposed checkpoint if it exists, since L1 is authoritative
|
|
188
|
+
await this.#proposedCheckpoints.delete(checkpoint.checkpoint.number);
|
|
188
189
|
}
|
|
189
|
-
// Clear the proposed checkpoint if any of the confirmed checkpoints match or supersede it
|
|
190
|
-
const lastConfirmedCheckpointNumber = checkpoints[checkpoints.length - 1].checkpoint.number;
|
|
191
|
-
await this.clearProposedCheckpointIfSuperseded(lastConfirmedCheckpointNumber);
|
|
192
190
|
await this.#lastSynchedL1Block.set(checkpoints[checkpoints.length - 1].l1.blockNumber);
|
|
193
191
|
return true;
|
|
194
192
|
});
|
|
@@ -218,7 +216,8 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
218
216
|
attestations: incoming.attestations.map((a)=>a.toBuffer()),
|
|
219
217
|
checkpointNumber: incoming.checkpoint.number,
|
|
220
218
|
startBlock: incoming.checkpoint.blocks[0].number,
|
|
221
|
-
blockCount: incoming.checkpoint.blocks.length
|
|
219
|
+
blockCount: incoming.checkpoint.blocks.length,
|
|
220
|
+
feeAssetPriceModifier: incoming.checkpoint.feeAssetPriceModifier.toString()
|
|
222
221
|
});
|
|
223
222
|
// Update the sync point to reflect the new L1 block
|
|
224
223
|
await this.#lastSynchedL1Block.set(incoming.l1.blockNumber);
|
|
@@ -233,11 +232,12 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
233
232
|
if (previousCheckpointNumber === INITIAL_CHECKPOINT_NUMBER - 1) {
|
|
234
233
|
return undefined;
|
|
235
234
|
}
|
|
236
|
-
|
|
237
|
-
|
|
235
|
+
// Check across both proposed and mined checkpoints
|
|
236
|
+
const predecessor = await this.getProposedCheckpointByNumber(previousCheckpointNumber) ?? await this.getCheckpointData(previousCheckpointNumber);
|
|
237
|
+
if (!predecessor) {
|
|
238
238
|
throw new CheckpointNotFoundError(previousCheckpointNumber);
|
|
239
239
|
}
|
|
240
|
-
const previousBlockNumber = BlockNumber(
|
|
240
|
+
const previousBlockNumber = BlockNumber(predecessor.startBlock + predecessor.blockCount - 1);
|
|
241
241
|
const previousBlock = await this.getBlock(previousBlockNumber);
|
|
242
242
|
if (previousBlock === undefined) {
|
|
243
243
|
throw new BlockNotFoundError(previousBlockNumber);
|
|
@@ -247,7 +247,7 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
247
247
|
/**
|
|
248
248
|
* Validates that blocks are sequential, have correct indexes, and chain via archive roots.
|
|
249
249
|
* This is the same validation used for both confirmed checkpoints (addCheckpoints) and
|
|
250
|
-
* proposed checkpoints (
|
|
250
|
+
* proposed checkpoints (addProposedCheckpoint).
|
|
251
251
|
*/ validateCheckpointBlocks(blocks, previousBlock) {
|
|
252
252
|
for (const block of blocks){
|
|
253
253
|
if (previousBlock) {
|
|
@@ -352,11 +352,8 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
352
352
|
await this.#checkpoints.delete(c);
|
|
353
353
|
this.#log.debug(`Removed checkpoint ${c}`);
|
|
354
354
|
}
|
|
355
|
-
//
|
|
356
|
-
|
|
357
|
-
if (proposedCheckpointNumber > checkpointNumber) {
|
|
358
|
-
await this.#proposedCheckpoint.delete();
|
|
359
|
-
}
|
|
355
|
+
// Evict all pending checkpoints > checkpointNumber (their base chain no longer exists)
|
|
356
|
+
await this.evictProposedCheckpointsFrom(CheckpointNumber(checkpointNumber + 1));
|
|
360
357
|
return {
|
|
361
358
|
blocksRemoved
|
|
362
359
|
};
|
|
@@ -401,6 +398,7 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
401
398
|
checkpointNumber: CheckpointNumber(checkpointStorage.checkpointNumber),
|
|
402
399
|
startBlock: BlockNumber(checkpointStorage.startBlock),
|
|
403
400
|
blockCount: checkpointStorage.blockCount,
|
|
401
|
+
feeAssetPriceModifier: BigInt(checkpointStorage.feeAssetPriceModifier),
|
|
404
402
|
l1: L1PublishedData.fromBuffer(checkpointStorage.l1),
|
|
405
403
|
attestations: checkpointStorage.attestations.map((buf)=>CommitteeAttestation.fromBuffer(buf))
|
|
406
404
|
};
|
|
@@ -487,36 +485,108 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
487
485
|
return CheckpointNumber(latestCheckpointNumber);
|
|
488
486
|
}
|
|
489
487
|
async hasProposedCheckpoint() {
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
await this.#proposedCheckpoint.delete();
|
|
488
|
+
const [key] = await toArray(this.#proposedCheckpoints.keysAsync({
|
|
489
|
+
limit: 1
|
|
490
|
+
}));
|
|
491
|
+
return key !== undefined;
|
|
495
492
|
}
|
|
496
|
-
/**
|
|
497
|
-
const
|
|
498
|
-
|
|
499
|
-
await this.#proposedCheckpoint.delete();
|
|
493
|
+
/** Deletes all pending proposed checkpoints from storage. */ async deleteProposedCheckpoints() {
|
|
494
|
+
for await (const key of this.#proposedCheckpoints.keysAsync()){
|
|
495
|
+
await this.#proposedCheckpoints.delete(key);
|
|
500
496
|
}
|
|
501
497
|
}
|
|
502
|
-
/**
|
|
503
|
-
|
|
504
|
-
|
|
498
|
+
/**
|
|
499
|
+
* Promotes a specific pending checkpoint to a confirmed checkpoint entry.
|
|
500
|
+
* This persists the checkpoint to the store, removes only that pending entry, and updates the L1 sync point.
|
|
501
|
+
* Remaining pending entries (e.g. N+1, N+2) are left intact — they chain off the just-promoted one.
|
|
502
|
+
* @param checkpointNumber - The checkpoint number to promote.
|
|
503
|
+
* @param l1 - L1 published data for the checkpoint.
|
|
504
|
+
* @param attestations - Committee attestations.
|
|
505
|
+
* @param expectedArchiveRoot - Archive root guard against races.
|
|
506
|
+
*/ async promoteProposedToCheckpointed(checkpointNumber, l1, attestations, expectedArchiveRoot) {
|
|
507
|
+
return await this.db.transactionAsync(async ()=>{
|
|
508
|
+
const proposed = await this.getProposedCheckpointByNumber(checkpointNumber);
|
|
509
|
+
if (!proposed) {
|
|
510
|
+
throw new NoProposedCheckpointToPromoteError();
|
|
511
|
+
}
|
|
512
|
+
if (!proposed.archive.root.equals(expectedArchiveRoot)) {
|
|
513
|
+
throw new ProposedCheckpointArchiveRootMismatchError(expectedArchiveRoot, proposed.archive.root);
|
|
514
|
+
}
|
|
515
|
+
// Verify sequentiality: promoted checkpoint must follow the latest confirmed one
|
|
516
|
+
const latestCheckpointNumber = await this.getLatestCheckpointNumber();
|
|
517
|
+
if (latestCheckpointNumber !== proposed.checkpointNumber - 1) {
|
|
518
|
+
throw new ProposedCheckpointPromotionNotSequentialError(proposed.checkpointNumber, latestCheckpointNumber);
|
|
519
|
+
}
|
|
520
|
+
// Write the checkpoint entry
|
|
521
|
+
await this.#checkpoints.set(proposed.checkpointNumber, {
|
|
522
|
+
header: proposed.header.toBuffer(),
|
|
523
|
+
archive: proposed.archive.toBuffer(),
|
|
524
|
+
checkpointOutHash: proposed.checkpointOutHash.toBuffer(),
|
|
525
|
+
l1: l1.toBuffer(),
|
|
526
|
+
attestations: attestations.map((attestation)=>attestation.toBuffer()),
|
|
527
|
+
checkpointNumber: proposed.checkpointNumber,
|
|
528
|
+
startBlock: proposed.startBlock,
|
|
529
|
+
blockCount: proposed.blockCount,
|
|
530
|
+
feeAssetPriceModifier: proposed.feeAssetPriceModifier.toString()
|
|
531
|
+
});
|
|
532
|
+
// Update the slot-to-checkpoint index
|
|
533
|
+
await this.#slotToCheckpoint.set(proposed.header.slotNumber, proposed.checkpointNumber);
|
|
534
|
+
// Remove only this pending entry — remaining entries N+1, N+2, ... stay valid
|
|
535
|
+
await this.#proposedCheckpoints.delete(proposed.checkpointNumber);
|
|
536
|
+
// Update the last synced L1 block
|
|
537
|
+
await this.#lastSynchedL1Block.set(l1.blockNumber);
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Returns the latest pending checkpoint (highest-numbered entry), or undefined if none.
|
|
542
|
+
* No fallback to confirmed.
|
|
543
|
+
*/ async getLastProposedCheckpoint() {
|
|
544
|
+
const [key] = await toArray(this.#proposedCheckpoints.keysAsync({
|
|
545
|
+
reverse: true,
|
|
546
|
+
limit: 1
|
|
547
|
+
}));
|
|
548
|
+
if (key === undefined) {
|
|
505
549
|
return undefined;
|
|
506
550
|
}
|
|
507
|
-
|
|
551
|
+
const stored = await this.#proposedCheckpoints.getAsync(key);
|
|
552
|
+
return stored ? this.convertToProposedCheckpointData(stored) : undefined;
|
|
553
|
+
}
|
|
554
|
+
/** Returns the pending checkpoint for a specific checkpoint number, or undefined if not found. */ async getProposedCheckpointByNumber(n) {
|
|
555
|
+
const stored = await this.#proposedCheckpoints.getAsync(n);
|
|
556
|
+
return stored ? this.convertToProposedCheckpointData(stored) : undefined;
|
|
557
|
+
}
|
|
558
|
+
/** Returns all pending checkpoints in ascending checkpoint-number order. */ async getProposedCheckpoints() {
|
|
559
|
+
const results = [];
|
|
560
|
+
for await (const [, stored] of this.#proposedCheckpoints.entriesAsync()){
|
|
561
|
+
results.push(this.convertToProposedCheckpointData(stored));
|
|
562
|
+
}
|
|
563
|
+
return results;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Evicts all pending checkpoints with checkpoint number >= fromNumber.
|
|
567
|
+
* Used for divergent-mined-checkpoint cleanup: when L1 mines checkpoint N with a different archive,
|
|
568
|
+
* all pending >= N must be evicted since they chain off the now-invalid pending N.
|
|
569
|
+
*/ async evictProposedCheckpointsFrom(fromNumber) {
|
|
570
|
+
const keysToDelete = [];
|
|
571
|
+
for await (const key of this.#proposedCheckpoints.keysAsync()){
|
|
572
|
+
if (key >= fromNumber) {
|
|
573
|
+
keysToDelete.push(key);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
for (const key of keysToDelete){
|
|
577
|
+
await this.#proposedCheckpoints.delete(key);
|
|
578
|
+
}
|
|
508
579
|
}
|
|
509
580
|
/**
|
|
510
|
-
* Gets the checkpoint at the proposed tip
|
|
511
|
-
* - pending checkpoint if
|
|
581
|
+
* Gets the checkpoint at the proposed tip:
|
|
582
|
+
* - latest pending checkpoint if any exist
|
|
512
583
|
* - fallsback to latest confirmed checkpoint otherwise
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
if (!stored) {
|
|
584
|
+
*/ async getLastCheckpoint() {
|
|
585
|
+
const latest = await this.getLastProposedCheckpoint();
|
|
586
|
+
if (!latest) {
|
|
517
587
|
return this.getCheckpointData(await this.getLatestCheckpointNumber());
|
|
518
588
|
}
|
|
519
|
-
return
|
|
589
|
+
return latest;
|
|
520
590
|
}
|
|
521
591
|
convertToProposedCheckpointData(stored) {
|
|
522
592
|
return {
|
|
@@ -534,7 +604,7 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
534
604
|
* Attempts to get the proposedCheckpoint's number, if there is not one, then fallback to the latest confirmed checkpoint number.
|
|
535
605
|
* @returns CheckpointNumber
|
|
536
606
|
*/ async getProposedCheckpointNumber() {
|
|
537
|
-
const proposed = await this.
|
|
607
|
+
const proposed = await this.getLastCheckpoint();
|
|
538
608
|
if (!proposed) {
|
|
539
609
|
return await this.getLatestCheckpointNumber();
|
|
540
610
|
}
|
|
@@ -544,7 +614,7 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
544
614
|
* Attempts to get the proposedCheckpoint's block number, if there is not one, then fallback to the checkpointed block number
|
|
545
615
|
* @returns BlockNumber
|
|
546
616
|
*/ async getProposedCheckpointL2BlockNumber() {
|
|
547
|
-
const proposed = await this.
|
|
617
|
+
const proposed = await this.getLastCheckpoint();
|
|
548
618
|
if (!proposed) {
|
|
549
619
|
return await this.getCheckpointedL2BlockNumber();
|
|
550
620
|
}
|
|
@@ -570,7 +640,10 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
570
640
|
* @param start - Number of the first block to return (inclusive).
|
|
571
641
|
* @param limit - The number of blocks to return.
|
|
572
642
|
* @returns The requested L2 blocks
|
|
573
|
-
*/
|
|
643
|
+
*/ getCheckpointedBlocks(start, limit) {
|
|
644
|
+
return toArray(this.iterateCheckpointedBlocks(start, limit));
|
|
645
|
+
}
|
|
646
|
+
/** Async iterator variant of {@link getCheckpointedBlocks}. */ async *iterateCheckpointedBlocks(start, limit) {
|
|
574
647
|
const checkpointCache = new Map();
|
|
575
648
|
for await (const [blockNumber, blockStorage] of this.getBlockStorages(start, limit)){
|
|
576
649
|
const block = await this.getBlockFromBlockStorage(blockNumber, blockStorage);
|
|
@@ -603,7 +676,10 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
603
676
|
* @param start - Number of the first block to return (inclusive).
|
|
604
677
|
* @param limit - The number of blocks to return.
|
|
605
678
|
* @returns The requested L2 blocks
|
|
606
|
-
*/
|
|
679
|
+
*/ getBlocks(start, limit) {
|
|
680
|
+
return toArray(this.iterateBlocks(start, limit));
|
|
681
|
+
}
|
|
682
|
+
/** Async iterator variant of {@link getBlocks}. */ async *iterateBlocks(start, limit) {
|
|
607
683
|
for await (const [blockNumber, blockStorage] of this.getBlockStorages(start, limit)){
|
|
608
684
|
const block = await this.getBlockFromBlockStorage(blockNumber, blockStorage);
|
|
609
685
|
if (block) {
|
|
@@ -623,6 +699,37 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
623
699
|
return this.getBlockDataFromBlockStorage(blockStorage);
|
|
624
700
|
}
|
|
625
701
|
/**
|
|
702
|
+
* Gets block metadata plus checkpoint-derived context (L1 publish info, attestations) without
|
|
703
|
+
* deserializing tx bodies. When the block's containing checkpoint has not yet been L1-confirmed,
|
|
704
|
+
* `checkpoint` and `l1` are `undefined` and `attestations` is empty.
|
|
705
|
+
*/ async getBlockDataWithCheckpointContext(blockNumber) {
|
|
706
|
+
const blockStorage = await this.#blocks.getAsync(blockNumber);
|
|
707
|
+
if (!blockStorage || !blockStorage.header) {
|
|
708
|
+
return undefined;
|
|
709
|
+
}
|
|
710
|
+
const data = this.getBlockDataFromBlockStorage(blockStorage);
|
|
711
|
+
const checkpointStorage = await this.#checkpoints.getAsync(blockStorage.checkpointNumber);
|
|
712
|
+
if (!checkpointStorage) {
|
|
713
|
+
return {
|
|
714
|
+
data,
|
|
715
|
+
checkpoint: undefined,
|
|
716
|
+
l1: undefined,
|
|
717
|
+
attestations: []
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
const checkpoint = this.checkpointDataFromCheckpointStorage(checkpointStorage);
|
|
721
|
+
return {
|
|
722
|
+
data,
|
|
723
|
+
checkpoint,
|
|
724
|
+
l1: checkpoint.l1,
|
|
725
|
+
attestations: checkpoint.attestations
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
/** Returns the checkpoint number that contains the given slot (or undefined if not found). */ async getCheckpointNumberBySlot(slot) {
|
|
729
|
+
const checkpointNumber = await this.#slotToCheckpoint.getAsync(slot);
|
|
730
|
+
return checkpointNumber === undefined ? undefined : CheckpointNumber(checkpointNumber);
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
626
733
|
* Gets block metadata (without tx data) by archive root.
|
|
627
734
|
* @param archive - The archive root of the block to return.
|
|
628
735
|
* @returns The requested block data.
|
|
@@ -701,7 +808,10 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
701
808
|
* @param start - Number of the first block to return (inclusive).
|
|
702
809
|
* @param limit - The number of blocks to return.
|
|
703
810
|
* @returns The requested L2 block headers
|
|
704
|
-
*/
|
|
811
|
+
*/ getBlockHeaders(start, limit) {
|
|
812
|
+
return toArray(this.iterateBlockHeaders(start, limit));
|
|
813
|
+
}
|
|
814
|
+
/** Async iterator variant of {@link getBlockHeaders}. */ async *iterateBlockHeaders(start, limit) {
|
|
705
815
|
for await (const [blockNumber, blockStorage] of this.getBlockStorages(start, limit)){
|
|
706
816
|
const header = BlockHeader.fromBuffer(blockStorage.header);
|
|
707
817
|
if (header.getBlockNumber() !== blockNumber) {
|
|
@@ -849,18 +959,23 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
849
959
|
setSynchedL1BlockNumber(l1BlockNumber) {
|
|
850
960
|
return this.#lastSynchedL1Block.set(l1BlockNumber);
|
|
851
961
|
}
|
|
852
|
-
/**
|
|
853
|
-
*
|
|
962
|
+
/**
|
|
963
|
+
* Adds a proposed checkpoint to the pending queue.
|
|
964
|
+
* Accepts proposed.checkpointNumber === latestTip + 1, where latestTip is the highest of
|
|
965
|
+
* confirmed and the highest pending checkpoint number.
|
|
966
|
+
* Computes archive and checkpointOutHash from the stored blocks.
|
|
967
|
+
*/ async addProposedCheckpoint(proposed) {
|
|
854
968
|
return await this.db.transactionAsync(async ()=>{
|
|
855
|
-
const current = await this.getProposedCheckpointNumber();
|
|
856
|
-
if (proposed.checkpointNumber <= current) {
|
|
857
|
-
throw new ProposedCheckpointStaleError(proposed.checkpointNumber, current);
|
|
858
|
-
}
|
|
859
969
|
const confirmed = await this.getLatestCheckpointNumber();
|
|
860
|
-
|
|
861
|
-
|
|
970
|
+
const [latestPendingKey] = await toArray(this.#proposedCheckpoints.keysAsync({
|
|
971
|
+
reverse: true,
|
|
972
|
+
limit: 1
|
|
973
|
+
}));
|
|
974
|
+
const latestTip = CheckpointNumber(latestPendingKey !== undefined ? Math.max(latestPendingKey, confirmed) : confirmed);
|
|
975
|
+
if (proposed.checkpointNumber !== latestTip + 1) {
|
|
976
|
+
throw new ProposedCheckpointNotSequentialError(proposed.checkpointNumber, latestTip);
|
|
862
977
|
}
|
|
863
|
-
// Ensure the
|
|
978
|
+
// Ensure the predecessor block (from pending or confirmed chain) exists
|
|
864
979
|
const previousBlock = await this.getPreviousCheckpointBlock(proposed.checkpointNumber);
|
|
865
980
|
const blocks = [];
|
|
866
981
|
for(let i = 0; i < proposed.blockCount; i++){
|
|
@@ -873,7 +988,7 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
873
988
|
this.validateCheckpointBlocks(blocks, previousBlock);
|
|
874
989
|
const archive = blocks[blocks.length - 1].archive;
|
|
875
990
|
const checkpointOutHash = Checkpoint.getCheckpointOutHash(blocks);
|
|
876
|
-
await this.#
|
|
991
|
+
await this.#proposedCheckpoints.set(proposed.checkpointNumber, {
|
|
877
992
|
header: proposed.header.toBuffer(),
|
|
878
993
|
archive: archive.toBuffer(),
|
|
879
994
|
checkpointOutHash: checkpointOutHash.toBuffer(),
|