@aztec/archiver 0.0.1-commit.3469e52 → 0.0.1-commit.381b1a9
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 +9 -0
- package/dest/archiver.d.ts +12 -8
- package/dest/archiver.d.ts.map +1 -1
- package/dest/archiver.js +81 -120
- package/dest/errors.d.ts +6 -1
- package/dest/errors.d.ts.map +1 -1
- package/dest/errors.js +8 -0
- package/dest/factory.d.ts +3 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +14 -11
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -0
- package/dest/l1/bin/retrieve-calldata.js +35 -32
- package/dest/l1/calldata_retriever.d.ts +73 -50
- package/dest/l1/calldata_retriever.d.ts.map +1 -1
- package/dest/l1/calldata_retriever.js +190 -259
- package/dest/l1/data_retrieval.d.ts +4 -7
- package/dest/l1/data_retrieval.d.ts.map +1 -1
- package/dest/l1/data_retrieval.js +12 -16
- package/dest/l1/spire_proposer.d.ts +5 -5
- package/dest/l1/spire_proposer.d.ts.map +1 -1
- package/dest/l1/spire_proposer.js +9 -17
- package/dest/l1/validate_trace.d.ts +6 -3
- package/dest/l1/validate_trace.d.ts.map +1 -1
- package/dest/l1/validate_trace.js +13 -9
- package/dest/modules/data_source_base.d.ts +25 -21
- package/dest/modules/data_source_base.d.ts.map +1 -1
- package/dest/modules/data_source_base.js +45 -120
- package/dest/modules/data_store_updater.d.ts +40 -21
- package/dest/modules/data_store_updater.d.ts.map +1 -1
- package/dest/modules/data_store_updater.js +114 -64
- package/dest/modules/instrumentation.d.ts +6 -4
- package/dest/modules/instrumentation.d.ts.map +1 -1
- package/dest/modules/instrumentation.js +26 -12
- package/dest/modules/l1_synchronizer.d.ts +5 -8
- package/dest/modules/l1_synchronizer.d.ts.map +1 -1
- package/dest/modules/l1_synchronizer.js +46 -20
- package/dest/store/block_store.d.ts +49 -32
- package/dest/store/block_store.d.ts.map +1 -1
- package/dest/store/block_store.js +165 -54
- package/dest/store/contract_class_store.d.ts +1 -1
- package/dest/store/contract_class_store.d.ts.map +1 -1
- package/dest/store/contract_class_store.js +11 -7
- package/dest/store/kv_archiver_store.d.ts +53 -25
- package/dest/store/kv_archiver_store.d.ts.map +1 -1
- package/dest/store/kv_archiver_store.js +50 -17
- package/dest/store/l2_tips_cache.d.ts +19 -0
- package/dest/store/l2_tips_cache.d.ts.map +1 -0
- package/dest/store/l2_tips_cache.js +89 -0
- package/dest/store/log_store.d.ts +4 -4
- package/dest/store/log_store.d.ts.map +1 -1
- package/dest/store/log_store.js +105 -47
- package/dest/store/message_store.js +1 -1
- package/dest/test/fake_l1_state.d.ts +16 -4
- package/dest/test/fake_l1_state.d.ts.map +1 -1
- package/dest/test/fake_l1_state.js +84 -20
- package/dest/test/index.js +3 -1
- package/dest/test/mock_archiver.d.ts +1 -1
- package/dest/test/mock_archiver.d.ts.map +1 -1
- package/dest/test/mock_archiver.js +3 -2
- package/dest/test/mock_l2_block_source.d.ts +39 -23
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +157 -112
- package/dest/test/mock_structs.d.ts +6 -2
- package/dest/test/mock_structs.d.ts.map +1 -1
- package/dest/test/mock_structs.js +24 -10
- package/dest/test/noop_l1_archiver.d.ts +26 -0
- package/dest/test/noop_l1_archiver.d.ts.map +1 -0
- package/dest/test/noop_l1_archiver.js +72 -0
- package/package.json +14 -13
- package/src/archiver.ts +106 -149
- package/src/errors.ts +12 -0
- package/src/factory.ts +29 -12
- package/src/index.ts +1 -0
- package/src/l1/README.md +25 -68
- package/src/l1/bin/retrieve-calldata.ts +45 -33
- package/src/l1/calldata_retriever.ts +249 -379
- package/src/l1/data_retrieval.ts +10 -20
- package/src/l1/spire_proposer.ts +7 -15
- package/src/l1/validate_trace.ts +24 -6
- package/src/modules/data_source_base.ts +76 -166
- package/src/modules/data_store_updater.ts +130 -66
- package/src/modules/instrumentation.ts +26 -14
- package/src/modules/l1_synchronizer.ts +55 -26
- package/src/store/block_store.ts +216 -92
- package/src/store/contract_class_store.ts +11 -7
- package/src/store/kv_archiver_store.ts +88 -30
- package/src/store/l2_tips_cache.ts +89 -0
- package/src/store/log_store.ts +171 -55
- package/src/store/message_store.ts +1 -1
- package/src/test/fake_l1_state.ts +112 -23
- package/src/test/index.ts +3 -0
- package/src/test/mock_archiver.ts +3 -2
- package/src/test/mock_l2_block_source.ts +211 -129
- package/src/test/mock_structs.ts +45 -15
- package/src/test/noop_l1_archiver.ts +115 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { range } from '@aztec/foundation/array';
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { isDefined } from '@aztec/foundation/types';
|
|
3
|
-
import { CheckpointedL2Block, CommitteeAttestation } from '@aztec/stdlib/block';
|
|
4
4
|
import { Checkpoint, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
5
5
|
import { getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
|
|
6
6
|
/**
|
|
@@ -40,9 +40,12 @@ import { getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
|
|
|
40
40
|
getCheckpointedBlock(number) {
|
|
41
41
|
return this.store.getCheckpointedBlock(number);
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
getCheckpointedL2BlockNumber() {
|
|
44
44
|
return this.store.getCheckpointedL2BlockNumber();
|
|
45
45
|
}
|
|
46
|
+
getFinalizedL2BlockNumber() {
|
|
47
|
+
return this.store.getFinalizedL2BlockNumber();
|
|
48
|
+
}
|
|
46
49
|
async getCheckpointHeader(number) {
|
|
47
50
|
if (number === 'latest') {
|
|
48
51
|
number = await this.store.getSynchedCheckpointNumber();
|
|
@@ -61,15 +64,10 @@ import { getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
|
|
|
61
64
|
if (!checkpointData) {
|
|
62
65
|
return undefined;
|
|
63
66
|
}
|
|
64
|
-
return BlockNumber(checkpointData.startBlock + checkpointData.
|
|
67
|
+
return BlockNumber(checkpointData.startBlock + checkpointData.blockCount - 1);
|
|
65
68
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (proven === true) {
|
|
69
|
-
const provenBlockNumber = await this.store.getProvenBlockNumber();
|
|
70
|
-
return blocks.filter((b)=>b.block.number <= provenBlockNumber);
|
|
71
|
-
}
|
|
72
|
-
return blocks;
|
|
69
|
+
getCheckpointedBlocks(from, limit) {
|
|
70
|
+
return this.store.getCheckpointedBlocks(from, limit);
|
|
73
71
|
}
|
|
74
72
|
getBlockHeaderByHash(blockHash) {
|
|
75
73
|
return this.store.getBlockHeaderByHash(blockHash);
|
|
@@ -77,7 +75,13 @@ import { getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
|
|
|
77
75
|
getBlockHeaderByArchive(archive) {
|
|
78
76
|
return this.store.getBlockHeaderByArchive(archive);
|
|
79
77
|
}
|
|
80
|
-
|
|
78
|
+
getBlockData(number) {
|
|
79
|
+
return this.store.getBlockData(number);
|
|
80
|
+
}
|
|
81
|
+
getBlockDataByArchive(archive) {
|
|
82
|
+
return this.store.getBlockDataByArchive(archive);
|
|
83
|
+
}
|
|
84
|
+
async getL2Block(number) {
|
|
81
85
|
// If the number provided is -ve, then return the latest block.
|
|
82
86
|
if (number < 0) {
|
|
83
87
|
number = await this.store.getLatestBlockNumber();
|
|
@@ -92,7 +96,7 @@ import { getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
|
|
|
92
96
|
return this.store.getTxEffect(txHash);
|
|
93
97
|
}
|
|
94
98
|
getSettledTxReceipt(txHash) {
|
|
95
|
-
return this.store.getSettledTxReceipt(txHash);
|
|
99
|
+
return this.store.getSettledTxReceipt(txHash, this.l1Constants);
|
|
96
100
|
}
|
|
97
101
|
isPendingChainInvalid() {
|
|
98
102
|
return this.getPendingChainValidationStatus().then((status)=>!status.valid);
|
|
@@ -102,14 +106,6 @@ import { getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
|
|
|
102
106
|
valid: true
|
|
103
107
|
};
|
|
104
108
|
}
|
|
105
|
-
async getL2BlocksNew(from, limit, proven) {
|
|
106
|
-
const blocks = await this.store.getBlocks(from, limit);
|
|
107
|
-
if (proven === true) {
|
|
108
|
-
const provenBlockNumber = await this.store.getProvenBlockNumber();
|
|
109
|
-
return blocks.filter((b)=>b.number <= provenBlockNumber);
|
|
110
|
-
}
|
|
111
|
-
return blocks;
|
|
112
|
-
}
|
|
113
109
|
getPrivateLogsByTags(tags, page) {
|
|
114
110
|
return this.store.getPrivateLogsByTags(tags, page);
|
|
115
111
|
}
|
|
@@ -154,107 +150,41 @@ import { getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
|
|
|
154
150
|
getL1ToL2MessageIndex(l1ToL2Message) {
|
|
155
151
|
return this.store.getL1ToL2MessageIndex(l1ToL2Message);
|
|
156
152
|
}
|
|
157
|
-
async
|
|
153
|
+
async getCheckpoints(checkpointNumber, limit) {
|
|
158
154
|
const checkpoints = await this.store.getRangeOfCheckpoints(checkpointNumber, limit);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const publishedCheckpoint = new PublishedCheckpoint(fullCheckpoint, checkpoint.l1, checkpoint.attestations.map((x)=>CommitteeAttestation.fromBuffer(x)));
|
|
166
|
-
fullCheckpoints.push(publishedCheckpoint);
|
|
155
|
+
return Promise.all(checkpoints.map((ch)=>this.getPublishedCheckpointFromCheckpointData(ch)));
|
|
156
|
+
}
|
|
157
|
+
async getPublishedCheckpointFromCheckpointData(checkpoint) {
|
|
158
|
+
const blocksForCheckpoint = await this.store.getBlocksForCheckpoint(checkpoint.checkpointNumber);
|
|
159
|
+
if (!blocksForCheckpoint) {
|
|
160
|
+
throw new Error(`Blocks for checkpoint ${checkpoint.checkpointNumber} not found`);
|
|
167
161
|
}
|
|
168
|
-
|
|
162
|
+
const fullCheckpoint = new Checkpoint(checkpoint.archive, checkpoint.header, blocksForCheckpoint, checkpoint.checkpointNumber);
|
|
163
|
+
return new PublishedCheckpoint(fullCheckpoint, checkpoint.l1, checkpoint.attestations);
|
|
169
164
|
}
|
|
170
165
|
getBlocksForSlot(slotNumber) {
|
|
171
166
|
return this.store.getBlocksForSlot(slotNumber);
|
|
172
167
|
}
|
|
173
|
-
async
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const [start, end] = getSlotRangeForEpoch(epochNumber, this.l1Constants);
|
|
178
|
-
const blocks = [];
|
|
179
|
-
// Walk the list of checkpoints backwards and filter by slots matching the requested epoch.
|
|
180
|
-
// We'll typically ask for checkpoints for a very recent epoch, so we shouldn't need an index here.
|
|
181
|
-
let checkpoint = await this.store.getCheckpointData(await this.store.getSynchedCheckpointNumber());
|
|
182
|
-
const slot = (b)=>b.header.slotNumber;
|
|
183
|
-
while(checkpoint && slot(checkpoint) >= start){
|
|
184
|
-
if (slot(checkpoint) <= end) {
|
|
185
|
-
// push the blocks on backwards
|
|
186
|
-
const endBlock = checkpoint.startBlock + checkpoint.numBlocks - 1;
|
|
187
|
-
for(let i = endBlock; i >= checkpoint.startBlock; i--){
|
|
188
|
-
const block = await this.getBlock(BlockNumber(i));
|
|
189
|
-
if (block) {
|
|
190
|
-
blocks.push(block);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
checkpoint = await this.store.getCheckpointData(CheckpointNumber(checkpoint.checkpointNumber - 1));
|
|
195
|
-
}
|
|
196
|
-
return blocks.reverse();
|
|
168
|
+
async getCheckpointedBlocksForEpoch(epochNumber) {
|
|
169
|
+
const checkpointsData = await this.getCheckpointsDataForEpoch(epochNumber);
|
|
170
|
+
const blocks = await Promise.all(checkpointsData.flatMap((checkpoint)=>range(checkpoint.blockCount, checkpoint.startBlock).map((blockNumber)=>this.getCheckpointedBlock(BlockNumber(blockNumber)))));
|
|
171
|
+
return blocks.filter(isDefined);
|
|
197
172
|
}
|
|
198
|
-
async
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
const [start, end] = getSlotRangeForEpoch(epochNumber, this.l1Constants);
|
|
203
|
-
const blocks = [];
|
|
204
|
-
// Walk the list of checkpoints backwards and filter by slots matching the requested epoch.
|
|
205
|
-
// We'll typically ask for checkpoints for a very recent epoch, so we shouldn't need an index here.
|
|
206
|
-
let checkpoint = await this.store.getCheckpointData(await this.store.getSynchedCheckpointNumber());
|
|
207
|
-
const slot = (b)=>b.header.slotNumber;
|
|
208
|
-
while(checkpoint && slot(checkpoint) >= start){
|
|
209
|
-
if (slot(checkpoint) <= end) {
|
|
210
|
-
// push the blocks on backwards
|
|
211
|
-
const endBlock = checkpoint.startBlock + checkpoint.numBlocks - 1;
|
|
212
|
-
for(let i = endBlock; i >= checkpoint.startBlock; i--){
|
|
213
|
-
const block = await this.getBlockHeader(BlockNumber(i));
|
|
214
|
-
if (block) {
|
|
215
|
-
blocks.push(block);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
checkpoint = await this.store.getCheckpointData(CheckpointNumber(checkpoint.checkpointNumber - 1));
|
|
220
|
-
}
|
|
221
|
-
return blocks.reverse();
|
|
173
|
+
async getCheckpointedBlockHeadersForEpoch(epochNumber) {
|
|
174
|
+
const checkpointsData = await this.getCheckpointsDataForEpoch(epochNumber);
|
|
175
|
+
const blocks = await Promise.all(checkpointsData.flatMap((checkpoint)=>range(checkpoint.blockCount, checkpoint.startBlock).map((blockNumber)=>this.getBlockHeader(BlockNumber(blockNumber)))));
|
|
176
|
+
return blocks.filter(isDefined);
|
|
222
177
|
}
|
|
223
178
|
async getCheckpointsForEpoch(epochNumber) {
|
|
179
|
+
const checkpointsData = await this.getCheckpointsDataForEpoch(epochNumber);
|
|
180
|
+
return Promise.all(checkpointsData.map((data)=>this.getPublishedCheckpointFromCheckpointData(data).then((p)=>p.checkpoint)));
|
|
181
|
+
}
|
|
182
|
+
/** Returns checkpoint data for all checkpoints whose slot falls within the given epoch. */ getCheckpointsDataForEpoch(epochNumber) {
|
|
224
183
|
if (!this.l1Constants) {
|
|
225
184
|
throw new Error('L1 constants not set');
|
|
226
185
|
}
|
|
227
186
|
const [start, end] = getSlotRangeForEpoch(epochNumber, this.l1Constants);
|
|
228
|
-
|
|
229
|
-
// Walk the list of checkpoints backwards and filter by slots matching the requested epoch.
|
|
230
|
-
// We'll typically ask for checkpoints for a very recent epoch, so we shouldn't need an index here.
|
|
231
|
-
let checkpointData = await this.store.getCheckpointData(await this.store.getSynchedCheckpointNumber());
|
|
232
|
-
const slot = (b)=>b.header.slotNumber;
|
|
233
|
-
while(checkpointData && slot(checkpointData) >= start){
|
|
234
|
-
if (slot(checkpointData) <= end) {
|
|
235
|
-
// push the checkpoints on backwards
|
|
236
|
-
const [checkpoint] = await this.getPublishedCheckpoints(checkpointData.checkpointNumber, 1);
|
|
237
|
-
checkpoints.push(checkpoint.checkpoint);
|
|
238
|
-
}
|
|
239
|
-
checkpointData = await this.store.getCheckpointData(CheckpointNumber(checkpointData.checkpointNumber - 1));
|
|
240
|
-
}
|
|
241
|
-
return checkpoints.reverse();
|
|
242
|
-
}
|
|
243
|
-
async getPublishedBlocks(from, limit, proven) {
|
|
244
|
-
const checkpoints = await this.store.getRangeOfCheckpoints(CheckpointNumber(from), limit);
|
|
245
|
-
const provenCheckpointNumber = await this.store.getProvenCheckpointNumber();
|
|
246
|
-
const blocks = (await Promise.all(checkpoints.map((ch)=>this.store.getBlocksForCheckpoint(ch.checkpointNumber)))).filter(isDefined);
|
|
247
|
-
const publishedBlocks = [];
|
|
248
|
-
for(let i = 0; i < checkpoints.length; i++){
|
|
249
|
-
const blockForCheckpoint = blocks[i][0];
|
|
250
|
-
const checkpoint = checkpoints[i];
|
|
251
|
-
if (checkpoint.checkpointNumber > provenCheckpointNumber && proven === true) {
|
|
252
|
-
continue;
|
|
253
|
-
}
|
|
254
|
-
const publishedBlock = new CheckpointedL2Block(checkpoint.checkpointNumber, blockForCheckpoint, checkpoint.l1, checkpoint.attestations.map((x)=>CommitteeAttestation.fromBuffer(x)));
|
|
255
|
-
publishedBlocks.push(publishedBlock);
|
|
256
|
-
}
|
|
257
|
-
return publishedBlocks;
|
|
187
|
+
return this.store.getCheckpointDataForSlotRange(start, end);
|
|
258
188
|
}
|
|
259
189
|
async getBlock(number) {
|
|
260
190
|
// If the number provided is -ve, then return the latest block.
|
|
@@ -266,25 +196,20 @@ import { getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
|
|
|
266
196
|
}
|
|
267
197
|
return this.store.getBlock(number);
|
|
268
198
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if (proven === true) {
|
|
272
|
-
const provenBlockNumber = await this.store.getProvenBlockNumber();
|
|
273
|
-
return blocks.filter((b)=>b.number <= provenBlockNumber);
|
|
274
|
-
}
|
|
275
|
-
return blocks;
|
|
199
|
+
getBlocks(from, limit) {
|
|
200
|
+
return this.store.getBlocks(from, limit);
|
|
276
201
|
}
|
|
277
|
-
|
|
202
|
+
getCheckpointedBlockByHash(blockHash) {
|
|
278
203
|
return this.store.getCheckpointedBlockByHash(blockHash);
|
|
279
204
|
}
|
|
280
|
-
|
|
205
|
+
getCheckpointedBlockByArchive(archive) {
|
|
281
206
|
return this.store.getCheckpointedBlockByArchive(archive);
|
|
282
207
|
}
|
|
283
|
-
async
|
|
208
|
+
async getL2BlockByHash(blockHash) {
|
|
284
209
|
const checkpointedBlock = await this.store.getCheckpointedBlockByHash(blockHash);
|
|
285
210
|
return checkpointedBlock?.block;
|
|
286
211
|
}
|
|
287
|
-
async
|
|
212
|
+
async getL2BlockByArchive(archive) {
|
|
288
213
|
const checkpointedBlock = await this.store.getCheckpointedBlockByArchive(archive);
|
|
289
214
|
return checkpointedBlock?.block;
|
|
290
215
|
}
|
|
@@ -1,32 +1,38 @@
|
|
|
1
|
-
import { BlockNumber,
|
|
2
|
-
import type {
|
|
3
|
-
import type
|
|
1
|
+
import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { L2Block, ValidateCheckpointResult } from '@aztec/stdlib/block';
|
|
3
|
+
import { type PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
4
4
|
import type { KVArchiverDataStore } from '../store/kv_archiver_store.js';
|
|
5
|
+
import type { L2TipsCache } from '../store/l2_tips_cache.js';
|
|
5
6
|
/** Result of adding checkpoints with information about any pruned blocks. */
|
|
6
7
|
type ReconcileCheckpointsResult = {
|
|
7
8
|
/** Blocks that were pruned due to conflict with L1 checkpoints. */
|
|
8
|
-
prunedBlocks:
|
|
9
|
+
prunedBlocks: L2Block[] | undefined;
|
|
9
10
|
/** Last block number that was already inserted locally, or undefined if none. */
|
|
10
11
|
lastAlreadyInsertedBlockNumber: BlockNumber | undefined;
|
|
11
12
|
};
|
|
12
13
|
/** Archiver helper module to handle updates to the data store. */
|
|
13
14
|
export declare class ArchiverDataStoreUpdater {
|
|
14
15
|
private store;
|
|
16
|
+
private l2TipsCache?;
|
|
17
|
+
private opts;
|
|
15
18
|
private readonly log;
|
|
16
|
-
constructor(store: KVArchiverDataStore
|
|
19
|
+
constructor(store: KVArchiverDataStore, l2TipsCache?: L2TipsCache | undefined, opts?: {
|
|
20
|
+
rollupManaLimit?: number;
|
|
21
|
+
});
|
|
17
22
|
/**
|
|
18
|
-
* Adds blocks to the store with contract class/instance extraction from logs.
|
|
23
|
+
* Adds proposed blocks to the store with contract class/instance extraction from logs.
|
|
24
|
+
* These are uncheckpointed blocks that have been proposed by the sequencer but not yet included in a checkpoint on L1.
|
|
19
25
|
* Extracts ContractClassPublished, ContractInstancePublished, ContractInstanceUpdated events,
|
|
20
26
|
* and individually broadcasted functions from the block logs.
|
|
21
27
|
*
|
|
22
|
-
* @param blocks - The L2 blocks to add.
|
|
28
|
+
* @param blocks - The proposed L2 blocks to add.
|
|
23
29
|
* @param pendingChainValidationStatus - Optional validation status to set.
|
|
24
30
|
* @returns True if the operation is successful.
|
|
25
31
|
*/
|
|
26
|
-
|
|
32
|
+
addProposedBlocks(blocks: L2Block[], pendingChainValidationStatus?: ValidateCheckpointResult): Promise<boolean>;
|
|
27
33
|
/**
|
|
28
34
|
* Reconciles local blocks with incoming checkpoints from L1.
|
|
29
|
-
* Adds checkpoints to the store with contract class/instance extraction from logs.
|
|
35
|
+
* Adds new checkpoints to the store with contract class/instance extraction from logs.
|
|
30
36
|
* Prunes any local blocks that conflict with checkpoint data (by comparing archive roots).
|
|
31
37
|
* Extracts ContractClassPublished, ContractInstancePublished, ContractInstanceUpdated events,
|
|
32
38
|
* and individually broadcasted functions from the checkpoint block logs.
|
|
@@ -35,35 +41,48 @@ export declare class ArchiverDataStoreUpdater {
|
|
|
35
41
|
* @param pendingChainValidationStatus - Optional validation status to set.
|
|
36
42
|
* @returns Result with information about any pruned blocks.
|
|
37
43
|
*/
|
|
38
|
-
|
|
44
|
+
addCheckpoints(checkpoints: PublishedCheckpoint[], pendingChainValidationStatus?: ValidateCheckpointResult): Promise<ReconcileCheckpointsResult>;
|
|
39
45
|
private pruneMismatchingLocalBlocks;
|
|
40
46
|
/**
|
|
41
|
-
* Removes all blocks strictly after the specified block number and cleans up associated contract data.
|
|
47
|
+
* Removes all uncheckpointed blocks strictly after the specified block number and cleans up associated contract data.
|
|
42
48
|
* This handles removal of provisionally added blocks along with their contract classes/instances.
|
|
49
|
+
* Verifies that each block being removed is not part of a stored checkpoint.
|
|
43
50
|
*
|
|
44
51
|
* @param blockNumber - Remove all blocks with number greater than this.
|
|
45
52
|
* @returns The removed blocks.
|
|
53
|
+
* @throws Error if any block to be removed is checkpointed.
|
|
46
54
|
*/
|
|
47
|
-
|
|
55
|
+
removeUncheckpointedBlocksAfter(blockNumber: BlockNumber): Promise<L2Block[]>;
|
|
56
|
+
private removeBlocksAfter;
|
|
48
57
|
/**
|
|
49
|
-
*
|
|
58
|
+
* Removes all checkpoints after the given checkpoint number.
|
|
50
59
|
* Deletes ContractClassPublished, ContractInstancePublished, ContractInstanceUpdated data
|
|
51
|
-
* that was stored for the
|
|
60
|
+
* that was stored for the removed checkpoints. Also removes ALL blocks (both checkpointed
|
|
61
|
+
* and uncheckpointed) after the last block of the given checkpoint.
|
|
52
62
|
*
|
|
53
|
-
* @param
|
|
54
|
-
* @param checkpointsToUnwind - The number of checkpoints to unwind.
|
|
63
|
+
* @param checkpointNumber - Remove all checkpoints strictly after this one.
|
|
55
64
|
* @returns True if the operation is successful.
|
|
56
65
|
*/
|
|
57
|
-
|
|
66
|
+
removeCheckpointsAfter(checkpointNumber: CheckpointNumber): Promise<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Updates the proven checkpoint number and refreshes the L2 tips cache.
|
|
69
|
+
* @param checkpointNumber - The checkpoint number to set as proven.
|
|
70
|
+
*/
|
|
71
|
+
setProvenCheckpointNumber(checkpointNumber: CheckpointNumber): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Updates the finalized checkpoint number and refreshes the L2 tips cache.
|
|
74
|
+
* @param checkpointNumber - The checkpoint number to set as finalized.
|
|
75
|
+
*/
|
|
76
|
+
setFinalizedCheckpointNumber(checkpointNumber: CheckpointNumber): Promise<void>;
|
|
58
77
|
/** Extracts and stores contract data from a single block. */
|
|
59
|
-
private
|
|
78
|
+
private addContractDataToDb;
|
|
60
79
|
/** Removes contract data associated with a block. */
|
|
61
|
-
private
|
|
62
|
-
private
|
|
80
|
+
private removeContractDataFromDb;
|
|
81
|
+
private updateContractDataOnDb;
|
|
63
82
|
private updatePublishedContractClasses;
|
|
64
83
|
private updateDeployedContractInstances;
|
|
65
84
|
private updateUpdatedContractInstances;
|
|
66
85
|
private storeBroadcastedIndividualFunctions;
|
|
67
86
|
}
|
|
68
87
|
export {};
|
|
69
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
88
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0YV9zdG9yZV91cG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data_store_updater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"data_store_updater.d.ts","sourceRoot":"","sources":["../../src/modules/data_store_updater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAahF,OAAO,KAAK,EAAE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,KAAK,mBAAmB,EAAsB,MAAM,0BAA0B,CAAC;AAcxF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAQ7D,6EAA6E;AAC7E,KAAK,0BAA0B,GAAG;IAChC,mEAAmE;IACnE,YAAY,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;IACpC,iFAAiF;IACjF,8BAA8B,EAAE,WAAW,GAAG,SAAS,CAAC;CACzD,CAAC;AAEF,kEAAkE;AAClE,qBAAa,wBAAwB;IAIjC,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,WAAW,CAAC;IACpB,OAAO,CAAC,IAAI;IALd,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA0C;IAE9D,YACU,KAAK,EAAE,mBAAmB,EAC1B,WAAW,CAAC,yBAAa,EACzB,IAAI,GAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAA;KAAO,EAC7C;IAEJ;;;;;;;;;OASG;IACU,iBAAiB,CAC5B,MAAM,EAAE,OAAO,EAAE,EACjB,4BAA4B,CAAC,EAAE,wBAAwB,GACtD,OAAO,CAAC,OAAO,CAAC,CAiBlB;IAED;;;;;;;;;;OAUG;IACU,cAAc,CACzB,WAAW,EAAE,mBAAmB,EAAE,EAClC,4BAA4B,CAAC,EAAE,wBAAwB,GACtD,OAAO,CAAC,0BAA0B,CAAC,CA6BrC;YAQa,2BAA2B;IAmEzC;;;;;;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