@aztec/archiver 0.0.1-commit.10bd49492 → 0.0.1-commit.11bf3dd6e
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 +12 -6
- package/dest/archiver.d.ts +6 -5
- package/dest/archiver.d.ts.map +1 -1
- package/dest/archiver.js +32 -15
- package/dest/config.d.ts +3 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +3 -2
- package/dest/errors.d.ts +28 -2
- package/dest/errors.d.ts.map +1 -1
- package/dest/errors.js +36 -2
- package/dest/factory.d.ts +2 -2
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +16 -13
- package/dest/l1/calldata_retriever.d.ts +1 -1
- package/dest/l1/calldata_retriever.d.ts.map +1 -1
- package/dest/l1/calldata_retriever.js +2 -1
- package/dest/l1/data_retrieval.d.ts +3 -3
- package/dest/l1/data_retrieval.d.ts.map +1 -1
- package/dest/l1/data_retrieval.js +14 -15
- package/dest/modules/data_source_base.d.ts +6 -4
- package/dest/modules/data_source_base.d.ts.map +1 -1
- package/dest/modules/data_source_base.js +10 -4
- package/dest/modules/data_store_updater.d.ts +5 -7
- package/dest/modules/data_store_updater.d.ts.map +1 -1
- package/dest/modules/data_store_updater.js +56 -65
- package/dest/modules/instrumentation.d.ts +4 -2
- package/dest/modules/instrumentation.d.ts.map +1 -1
- package/dest/modules/instrumentation.js +17 -6
- package/dest/modules/l1_synchronizer.d.ts +3 -2
- package/dest/modules/l1_synchronizer.d.ts.map +1 -1
- package/dest/modules/l1_synchronizer.js +139 -128
- package/dest/modules/validation.d.ts +1 -1
- package/dest/modules/validation.d.ts.map +1 -1
- package/dest/modules/validation.js +2 -2
- package/dest/store/block_store.d.ts +39 -4
- package/dest/store/block_store.d.ts.map +1 -1
- package/dest/store/block_store.js +232 -63
- package/dest/store/contract_class_store.d.ts +2 -3
- package/dest/store/contract_class_store.d.ts.map +1 -1
- package/dest/store/contract_class_store.js +7 -67
- package/dest/store/contract_instance_store.d.ts +1 -1
- package/dest/store/contract_instance_store.d.ts.map +1 -1
- package/dest/store/contract_instance_store.js +6 -2
- package/dest/store/kv_archiver_store.d.ts +30 -16
- package/dest/store/kv_archiver_store.d.ts.map +1 -1
- package/dest/store/kv_archiver_store.js +36 -18
- package/dest/store/l2_tips_cache.d.ts +2 -1
- package/dest/store/l2_tips_cache.d.ts.map +1 -1
- package/dest/store/l2_tips_cache.js +27 -7
- package/dest/store/log_store.d.ts +6 -3
- package/dest/store/log_store.d.ts.map +1 -1
- package/dest/store/log_store.js +95 -20
- package/dest/store/message_store.d.ts +5 -1
- package/dest/store/message_store.d.ts.map +1 -1
- package/dest/store/message_store.js +20 -8
- package/dest/test/fake_l1_state.d.ts +9 -1
- package/dest/test/fake_l1_state.d.ts.map +1 -1
- package/dest/test/fake_l1_state.js +49 -6
- package/dest/test/mock_l1_to_l2_message_source.d.ts +1 -1
- package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/test/mock_l1_to_l2_message_source.js +2 -1
- package/dest/test/mock_l2_block_source.d.ts +7 -2
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +28 -3
- package/dest/test/noop_l1_archiver.d.ts +1 -1
- package/dest/test/noop_l1_archiver.d.ts.map +1 -1
- package/dest/test/noop_l1_archiver.js +0 -1
- package/package.json +13 -13
- package/src/archiver.ts +43 -20
- package/src/config.ts +9 -2
- package/src/errors.ts +60 -2
- package/src/factory.ts +17 -10
- package/src/l1/calldata_retriever.ts +2 -1
- package/src/l1/data_retrieval.ts +8 -12
- package/src/modules/data_source_base.ts +23 -4
- package/src/modules/data_store_updater.ts +68 -95
- package/src/modules/instrumentation.ts +19 -7
- package/src/modules/l1_synchronizer.ts +159 -160
- package/src/modules/validation.ts +2 -2
- package/src/store/block_store.ts +301 -74
- package/src/store/contract_class_store.ts +8 -106
- package/src/store/contract_instance_store.ts +8 -5
- package/src/store/kv_archiver_store.ts +56 -32
- package/src/store/l2_tips_cache.ts +58 -13
- package/src/store/log_store.ts +128 -32
- package/src/store/message_store.ts +26 -9
- package/src/structs/inbox_message.ts +1 -1
- package/src/test/fake_l1_state.ts +68 -9
- package/src/test/mock_l1_to_l2_message_source.ts +1 -0
- package/src/test/mock_l2_block_source.ts +37 -2
- package/src/test/noop_l1_archiver.ts +0 -1
|
@@ -19,6 +19,7 @@ import { TxExecutionResult, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
19
19
|
provenBlockNumber = 0;
|
|
20
20
|
finalizedBlockNumber = 0;
|
|
21
21
|
checkpointedBlockNumber = 0;
|
|
22
|
+
proposedCheckpointBlockNumber = 0;
|
|
22
23
|
log = createLogger('archiver:mock_l2_block_source');
|
|
23
24
|
/** Creates blocks grouped into single-block checkpoints. */ async createBlocks(numBlocks) {
|
|
24
25
|
await this.createCheckpoints(numBlocks, 1);
|
|
@@ -56,6 +57,7 @@ import { TxExecutionResult, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
56
57
|
});
|
|
57
58
|
// Keep tip numbers consistent with remaining blocks.
|
|
58
59
|
this.checkpointedBlockNumber = Math.min(this.checkpointedBlockNumber, maxBlockNum);
|
|
60
|
+
this.proposedCheckpointBlockNumber = Math.min(this.proposedCheckpointBlockNumber, maxBlockNum);
|
|
59
61
|
this.provenBlockNumber = Math.min(this.provenBlockNumber, maxBlockNum);
|
|
60
62
|
this.finalizedBlockNumber = Math.min(this.finalizedBlockNumber, maxBlockNum);
|
|
61
63
|
this.log.verbose(`Removed ${numBlocks} blocks from the mock L2 block source`);
|
|
@@ -69,9 +71,16 @@ import { TxExecutionResult, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
69
71
|
}
|
|
70
72
|
this.finalizedBlockNumber = finalizedBlockNumber;
|
|
71
73
|
}
|
|
74
|
+
setProposedCheckpointBlockNumber(blockNumber) {
|
|
75
|
+
this.proposedCheckpointBlockNumber = blockNumber;
|
|
76
|
+
}
|
|
72
77
|
setCheckpointedBlockNumber(checkpointedBlockNumber) {
|
|
73
78
|
const prevCheckpointed = this.checkpointedBlockNumber;
|
|
74
79
|
this.checkpointedBlockNumber = checkpointedBlockNumber;
|
|
80
|
+
// Proposed checkpoint is always at least as advanced as checkpointed
|
|
81
|
+
if (this.proposedCheckpointBlockNumber < checkpointedBlockNumber) {
|
|
82
|
+
this.proposedCheckpointBlockNumber = checkpointedBlockNumber;
|
|
83
|
+
}
|
|
75
84
|
// Auto-create single-block checkpoints for newly checkpointed blocks that don't have one yet.
|
|
76
85
|
// This handles blocks added via addProposedBlocks that are now being marked as checkpointed.
|
|
77
86
|
const newCheckpoints = [];
|
|
@@ -124,6 +133,9 @@ import { TxExecutionResult, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
124
133
|
getFinalizedL2BlockNumber() {
|
|
125
134
|
return Promise.resolve(BlockNumber(this.finalizedBlockNumber));
|
|
126
135
|
}
|
|
136
|
+
getProposedCheckpointL2BlockNumber() {
|
|
137
|
+
return Promise.resolve(BlockNumber(this.proposedCheckpointBlockNumber));
|
|
138
|
+
}
|
|
127
139
|
getCheckpointedBlock(number) {
|
|
128
140
|
if (number > this.checkpointedBlockNumber) {
|
|
129
141
|
return Promise.resolve(undefined);
|
|
@@ -315,16 +327,18 @@ import { TxExecutionResult, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
315
327
|
return undefined;
|
|
316
328
|
}
|
|
317
329
|
async getL2Tips() {
|
|
318
|
-
const [latest, proven, finalized, checkpointed] = [
|
|
330
|
+
const [latest, proven, finalized, checkpointed, proposedCheckpoint] = [
|
|
319
331
|
await this.getBlockNumber(),
|
|
320
332
|
await this.getProvenBlockNumber(),
|
|
321
333
|
this.finalizedBlockNumber,
|
|
322
|
-
this.checkpointedBlockNumber
|
|
334
|
+
this.checkpointedBlockNumber,
|
|
335
|
+
await this.getProposedCheckpointL2BlockNumber()
|
|
323
336
|
];
|
|
324
337
|
const latestBlock = this.l2Blocks[latest - 1];
|
|
325
338
|
const provenBlock = this.l2Blocks[proven - 1];
|
|
326
339
|
const finalizedBlock = this.l2Blocks[finalized - 1];
|
|
327
340
|
const checkpointedBlock = this.l2Blocks[checkpointed - 1];
|
|
341
|
+
const proposedCheckpointBlock = this.l2Blocks[proposedCheckpoint - 1];
|
|
328
342
|
const latestBlockId = {
|
|
329
343
|
number: BlockNumber(latest),
|
|
330
344
|
hash: (await latestBlock?.hash())?.toString()
|
|
@@ -341,6 +355,10 @@ import { TxExecutionResult, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
341
355
|
number: BlockNumber(checkpointed),
|
|
342
356
|
hash: (await checkpointedBlock?.hash())?.toString()
|
|
343
357
|
};
|
|
358
|
+
const proposedCheckpointBlockId = {
|
|
359
|
+
number: BlockNumber(proposedCheckpoint),
|
|
360
|
+
hash: (await proposedCheckpointBlock?.hash())?.toString()
|
|
361
|
+
};
|
|
344
362
|
const makeTipId = (blockId)=>({
|
|
345
363
|
block: blockId,
|
|
346
364
|
checkpoint: {
|
|
@@ -352,7 +370,8 @@ import { TxExecutionResult, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
352
370
|
proposed: latestBlockId,
|
|
353
371
|
checkpointed: makeTipId(checkpointedBlockId),
|
|
354
372
|
proven: makeTipId(provenBlockId),
|
|
355
|
-
finalized: makeTipId(finalizedBlockId)
|
|
373
|
+
finalized: makeTipId(finalizedBlockId),
|
|
374
|
+
proposedCheckpoint: makeTipId(proposedCheckpointBlockId)
|
|
356
375
|
};
|
|
357
376
|
}
|
|
358
377
|
getSyncedL2EpochNumber() {
|
|
@@ -418,6 +437,12 @@ import { TxExecutionResult, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
418
437
|
valid: true
|
|
419
438
|
});
|
|
420
439
|
}
|
|
440
|
+
getProposedCheckpoint() {
|
|
441
|
+
return Promise.resolve(undefined);
|
|
442
|
+
}
|
|
443
|
+
getProposedCheckpointOnly() {
|
|
444
|
+
return Promise.resolve(undefined);
|
|
445
|
+
}
|
|
421
446
|
/** Returns checkpoints whose slot falls within the given epoch. */ getCheckpointsInEpoch(epochNumber) {
|
|
422
447
|
const epochDuration = DefaultL1ContractsConfig.aztecEpochDuration;
|
|
423
448
|
const [start, end] = getSlotRangeForEpoch(epochNumber, {
|
|
@@ -23,4 +23,4 @@ export declare class NoopL1Archiver extends Archiver {
|
|
|
23
23
|
export declare function createNoopL1Archiver(dataStore: KVArchiverDataStore, l1Constants: L1RollupConstants & {
|
|
24
24
|
genesisArchiveRoot: Fr;
|
|
25
25
|
}, telemetry?: TelemetryClient): Promise<NoopL1Archiver>;
|
|
26
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9vcF9sMV9hcmNoaXZlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3Qvbm9vcF9sMV9hcmNoaXZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFN0QsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBSXBELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDckUsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFtQyxNQUFNLHlCQUF5QixDQUFDO0FBS2hHLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUMxQyxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUV4RSxPQUFPLEtBQUssRUFBRSxtQkFBbUIsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBeUJ6RTs7OztHQUlHO0FBQ0gscUJBQWEsY0FBZSxTQUFRLFFBQVE7SUFDMUMsWUFDRSxTQUFTLEVBQUUsbUJBQW1CLEVBQzlCLFdBQVcsRUFBRSxpQkFBaUIsR0FBRztRQUFFLGtCQUFrQixFQUFFLEVBQUUsQ0FBQTtLQUFFLEVBQzNELGVBQWUsRUFBRSx1QkFBdUIsRUFzQ3pDO0lBRUQsbURBQW1EO0lBQ25DLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQyxFQUFFLE9BQU8sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBSWhFO0lBRUQsNkVBQTZFO0lBQzdELHFCQUFxQixJQUFJLE9BQU8sQ0FBQyxVQUFVLEdBQUcsU0FBUyxDQUFDLENBRXZFO0NBQ0Y7QUFFRCxtRUFBbUU7QUFDbkUsd0JBQXNCLG9CQUFvQixDQUN4QyxTQUFTLEVBQUUsbUJBQW1CLEVBQzlCLFdBQVcsRUFBRSxpQkFBaUIsR0FBRztJQUFFLGtCQUFrQixFQUFFLEVBQUUsQ0FBQTtDQUFFLEVBQzNELFNBQVMsR0FBRSxlQUFzQyxHQUNoRCxPQUFPLENBQUMsY0FBYyxDQUFDLENBR3pCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noop_l1_archiver.d.ts","sourceRoot":"","sources":["../../src/test/noop_l1_archiver.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAIpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,KAAK,eAAe,EAAmC,MAAM,yBAAyB,CAAC;AAKhG,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAyBzE;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,YACE,SAAS,EAAE,mBAAmB,EAC9B,WAAW,EAAE,iBAAiB,GAAG;QAAE,kBAAkB,EAAE,EAAE,CAAA;KAAE,EAC3D,eAAe,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"noop_l1_archiver.d.ts","sourceRoot":"","sources":["../../src/test/noop_l1_archiver.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAIpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,KAAK,eAAe,EAAmC,MAAM,yBAAyB,CAAC;AAKhG,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAyBzE;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,YACE,SAAS,EAAE,mBAAmB,EAC9B,WAAW,EAAE,iBAAiB,GAAG;QAAE,kBAAkB,EAAE,EAAE,CAAA;KAAE,EAC3D,eAAe,EAAE,uBAAuB,EAsCzC;IAED,mDAAmD;IACnC,KAAK,CAAC,iBAAiB,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAIhE;IAED,6EAA6E;IAC7D,qBAAqB,IAAI,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAEvE;CACF;AAED,mEAAmE;AACnE,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,mBAAmB,EAC9B,WAAW,EAAE,iBAAiB,GAAG;IAAE,kBAAkB,EAAE,EAAE,CAAA;CAAE,EAC3D,SAAS,GAAE,eAAsC,GAChD,OAAO,CAAC,cAAc,CAAC,CAGzB"}
|
|
@@ -44,7 +44,6 @@ import { ArchiverInstrumentation } from '../modules/instrumentation.js';
|
|
|
44
44
|
super(publicClient, debugClient, rollup, {
|
|
45
45
|
registryAddress: EthAddress.ZERO,
|
|
46
46
|
governanceProposerAddress: EthAddress.ZERO,
|
|
47
|
-
slashFactoryAddress: EthAddress.ZERO,
|
|
48
47
|
slashingProposerAddress: EthAddress.ZERO
|
|
49
48
|
}, dataStore, {
|
|
50
49
|
pollingIntervalMs: 1000,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/archiver",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.11bf3dd6e",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -65,18 +65,18 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
69
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
70
|
-
"@aztec/constants": "0.0.1-commit.
|
|
71
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
72
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
73
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
74
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
75
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
76
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
77
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
78
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
79
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
68
|
+
"@aztec/blob-client": "0.0.1-commit.11bf3dd6e",
|
|
69
|
+
"@aztec/blob-lib": "0.0.1-commit.11bf3dd6e",
|
|
70
|
+
"@aztec/constants": "0.0.1-commit.11bf3dd6e",
|
|
71
|
+
"@aztec/epoch-cache": "0.0.1-commit.11bf3dd6e",
|
|
72
|
+
"@aztec/ethereum": "0.0.1-commit.11bf3dd6e",
|
|
73
|
+
"@aztec/foundation": "0.0.1-commit.11bf3dd6e",
|
|
74
|
+
"@aztec/kv-store": "0.0.1-commit.11bf3dd6e",
|
|
75
|
+
"@aztec/l1-artifacts": "0.0.1-commit.11bf3dd6e",
|
|
76
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.11bf3dd6e",
|
|
77
|
+
"@aztec/protocol-contracts": "0.0.1-commit.11bf3dd6e",
|
|
78
|
+
"@aztec/stdlib": "0.0.1-commit.11bf3dd6e",
|
|
79
|
+
"@aztec/telemetry-client": "0.0.1-commit.11bf3dd6e",
|
|
80
80
|
"lodash.groupby": "^4.6.0",
|
|
81
81
|
"lodash.omit": "^4.5.0",
|
|
82
82
|
"tslib": "^2.5.0",
|
package/src/archiver.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
11
11
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
12
12
|
import { type PromiseWithResolvers, promiseWithResolvers } from '@aztec/foundation/promise';
|
|
13
13
|
import { RunningPromise, makeLoggingErrorHandler } from '@aztec/foundation/running-promise';
|
|
14
|
-
import { DateProvider } from '@aztec/foundation/timer';
|
|
14
|
+
import { DateProvider, elapsed } from '@aztec/foundation/timer';
|
|
15
15
|
import {
|
|
16
16
|
type ArchiverEmitter,
|
|
17
17
|
L2Block,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
type L2Tips,
|
|
20
20
|
type ValidateCheckpointResult,
|
|
21
21
|
} from '@aztec/stdlib/block';
|
|
22
|
-
import { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
22
|
+
import { type ProposedCheckpointInput, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
23
23
|
import {
|
|
24
24
|
type L1RollupConstants,
|
|
25
25
|
getEpochAtSlot,
|
|
@@ -85,17 +85,18 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
|
|
|
85
85
|
|
|
86
86
|
public readonly tracer: Tracer;
|
|
87
87
|
|
|
88
|
+
private readonly instrumentation: ArchiverInstrumentation;
|
|
89
|
+
|
|
88
90
|
/**
|
|
89
91
|
* Creates a new instance of the Archiver.
|
|
90
92
|
* @param publicClient - A client for interacting with the Ethereum node.
|
|
91
93
|
* @param debugClient - A client for interacting with the Ethereum node for debug/trace methods.
|
|
92
94
|
* @param rollup - Rollup contract instance.
|
|
93
95
|
* @param inbox - Inbox contract instance.
|
|
94
|
-
* @param l1Addresses - L1 contract addresses (registry, governance proposer,
|
|
96
|
+
* @param l1Addresses - L1 contract addresses (registry, governance proposer, slashing proposer).
|
|
95
97
|
* @param dataStore - An archiver data store for storage & retrieval of blocks, encrypted logs & contract data.
|
|
96
98
|
* @param config - Archiver configuration options.
|
|
97
99
|
* @param blobClient - Client for retrieving blob data.
|
|
98
|
-
* @param epochCache - Cache for epoch-related data.
|
|
99
100
|
* @param dateProvider - Provider for current date/time.
|
|
100
101
|
* @param instrumentation - Instrumentation for metrics and tracing.
|
|
101
102
|
* @param l1Constants - L1 rollup constants.
|
|
@@ -105,10 +106,9 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
|
|
|
105
106
|
private readonly publicClient: ViemPublicClient,
|
|
106
107
|
private readonly debugClient: ViemPublicDebugClient,
|
|
107
108
|
private readonly rollup: RollupContract,
|
|
108
|
-
private readonly l1Addresses: Pick<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
> & { slashingProposerAddress: EthAddress },
|
|
109
|
+
private readonly l1Addresses: Pick<L1ContractAddresses, 'registryAddress' | 'governanceProposerAddress'> & {
|
|
110
|
+
slashingProposerAddress: EthAddress;
|
|
111
|
+
},
|
|
112
112
|
readonly dataStore: KVArchiverDataStore,
|
|
113
113
|
private config: {
|
|
114
114
|
pollingIntervalMs: number;
|
|
@@ -131,6 +131,7 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
|
|
|
131
131
|
super(dataStore, l1Constants);
|
|
132
132
|
|
|
133
133
|
this.tracer = instrumentation.tracer;
|
|
134
|
+
this.instrumentation = instrumentation;
|
|
134
135
|
this.initialSyncPromise = promiseWithResolvers();
|
|
135
136
|
this.synchronizer = synchronizer;
|
|
136
137
|
this.events = events;
|
|
@@ -210,6 +211,10 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
|
|
|
210
211
|
});
|
|
211
212
|
}
|
|
212
213
|
|
|
214
|
+
public async setProposedCheckpoint(pending: ProposedCheckpointInput): Promise<void> {
|
|
215
|
+
await this.updater.setProposedCheckpoint(pending);
|
|
216
|
+
}
|
|
217
|
+
|
|
213
218
|
/**
|
|
214
219
|
* Processes all queued blocks, adding them to the store.
|
|
215
220
|
* Called at the beginning of each sync iteration.
|
|
@@ -242,7 +247,8 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
|
|
|
242
247
|
}
|
|
243
248
|
|
|
244
249
|
try {
|
|
245
|
-
await this.updater.addProposedBlock(block);
|
|
250
|
+
const [durationMs] = await elapsed(() => this.updater.addProposedBlock(block));
|
|
251
|
+
this.instrumentation.processNewProposedBlock(durationMs, block);
|
|
246
252
|
this.log.debug(`Added block ${block.number} to store`);
|
|
247
253
|
resolve();
|
|
248
254
|
} catch (err: any) {
|
|
@@ -342,19 +348,33 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
|
|
|
342
348
|
return Promise.resolve(this.synchronizer.getL1Timestamp());
|
|
343
349
|
}
|
|
344
350
|
|
|
345
|
-
public getSyncedL2SlotNumber(): Promise<SlotNumber | undefined> {
|
|
351
|
+
public async getSyncedL2SlotNumber(): Promise<SlotNumber | undefined> {
|
|
352
|
+
// The synced L2 slot is the latest slot for which we have all L1 data,
|
|
353
|
+
// either because we have seen all L1 blocks for that slot, or because
|
|
354
|
+
// we have seen the corresponding checkpoint.
|
|
355
|
+
|
|
356
|
+
let slotFromL1Sync: SlotNumber | undefined;
|
|
346
357
|
const l1Timestamp = this.synchronizer.getL1Timestamp();
|
|
347
|
-
if (l1Timestamp
|
|
348
|
-
|
|
358
|
+
if (l1Timestamp !== undefined) {
|
|
359
|
+
const nextL1BlockSlot = getSlotAtNextL1Block(l1Timestamp, this.l1Constants);
|
|
360
|
+
if (Number(nextL1BlockSlot) > 0) {
|
|
361
|
+
slotFromL1Sync = SlotNumber.add(nextL1BlockSlot, -1);
|
|
362
|
+
}
|
|
349
363
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
364
|
+
|
|
365
|
+
let slotFromCheckpoint: SlotNumber | undefined;
|
|
366
|
+
const latestCheckpointNumber = await this.store.getSynchedCheckpointNumber();
|
|
367
|
+
if (latestCheckpointNumber > 0) {
|
|
368
|
+
const checkpointData = await this.store.getCheckpointData(latestCheckpointNumber);
|
|
369
|
+
if (checkpointData) {
|
|
370
|
+
slotFromCheckpoint = checkpointData.header.slotNumber;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (slotFromL1Sync === undefined && slotFromCheckpoint === undefined) {
|
|
375
|
+
return undefined;
|
|
356
376
|
}
|
|
357
|
-
return
|
|
377
|
+
return SlotNumber(Math.max(slotFromL1Sync ?? 0, slotFromCheckpoint ?? 0));
|
|
358
378
|
}
|
|
359
379
|
|
|
360
380
|
public async getSyncedL2EpochNumber(): Promise<EpochNumber | undefined> {
|
|
@@ -473,7 +493,10 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
|
|
|
473
493
|
await this.store.rollbackL1ToL2MessagesToCheckpoint(targetCheckpointNumber);
|
|
474
494
|
this.log.info(`Setting L1 syncpoints to ${targetL1BlockNumber}`);
|
|
475
495
|
await this.store.setCheckpointSynchedL1BlockNumber(targetL1BlockNumber);
|
|
476
|
-
await this.store.
|
|
496
|
+
await this.store.setMessageSyncState(
|
|
497
|
+
{ l1BlockNumber: targetL1BlockNumber, l1BlockHash: targetL1BlockHash },
|
|
498
|
+
undefined,
|
|
499
|
+
);
|
|
477
500
|
if (targetL2BlockNumber < currentProvenBlock) {
|
|
478
501
|
this.log.info(`Rolling back proven L2 checkpoint to ${targetCheckpointNumber}`);
|
|
479
502
|
await this.updater.setProvenCheckpointNumber(targetCheckpointNumber);
|
package/src/config.ts
CHANGED
|
@@ -8,7 +8,12 @@ import {
|
|
|
8
8
|
getConfigFromMappings,
|
|
9
9
|
numberConfigHelper,
|
|
10
10
|
} from '@aztec/foundation/config';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
type ChainConfig,
|
|
13
|
+
type PipelineConfig,
|
|
14
|
+
chainConfigMappings,
|
|
15
|
+
pipelineConfigMappings,
|
|
16
|
+
} from '@aztec/stdlib/config';
|
|
12
17
|
import type { ArchiverSpecificConfig } from '@aztec/stdlib/interfaces/server';
|
|
13
18
|
|
|
14
19
|
/**
|
|
@@ -21,11 +26,13 @@ import type { ArchiverSpecificConfig } from '@aztec/stdlib/interfaces/server';
|
|
|
21
26
|
export type ArchiverConfig = ArchiverSpecificConfig &
|
|
22
27
|
L1ReaderConfig &
|
|
23
28
|
L1ContractsConfig &
|
|
29
|
+
PipelineConfig & // required to pass through to epoch cache
|
|
24
30
|
BlobClientConfig &
|
|
25
31
|
ChainConfig;
|
|
26
32
|
|
|
27
33
|
export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
|
|
28
34
|
...blobClientConfigMapping,
|
|
35
|
+
...pipelineConfigMappings,
|
|
29
36
|
archiverPollingIntervalMS: {
|
|
30
37
|
env: 'ARCHIVER_POLLING_INTERVAL_MS',
|
|
31
38
|
description: 'The polling interval in ms for retrieving new L2 blocks and encrypted logs.',
|
|
@@ -43,7 +50,7 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
|
|
|
43
50
|
},
|
|
44
51
|
archiverStoreMapSizeKb: {
|
|
45
52
|
env: 'ARCHIVER_STORE_MAP_SIZE_KB',
|
|
46
|
-
parseEnv: (val: string
|
|
53
|
+
parseEnv: (val: string) => +val,
|
|
47
54
|
description: 'The maximum possible size of the archiver DB in KB. Overwrites the general dataStoreMapSizeKb.',
|
|
48
55
|
},
|
|
49
56
|
skipValidateCheckpointAttestations: {
|
package/src/errors.ts
CHANGED
|
@@ -26,9 +26,13 @@ export class InitialCheckpointNumberNotSequentialError extends Error {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export class CheckpointNumberNotSequentialError extends Error {
|
|
29
|
-
constructor(
|
|
29
|
+
constructor(
|
|
30
|
+
newCheckpointNumber: number,
|
|
31
|
+
previous: number | undefined,
|
|
32
|
+
source: 'confirmed' | 'proposed' = 'confirmed',
|
|
33
|
+
) {
|
|
30
34
|
super(
|
|
31
|
-
`Cannot insert new checkpoint ${newCheckpointNumber} given previous checkpoint number
|
|
35
|
+
`Cannot insert new checkpoint ${newCheckpointNumber} given previous ${source} checkpoint number is ${previous ?? 'undefined'}`,
|
|
32
36
|
);
|
|
33
37
|
}
|
|
34
38
|
}
|
|
@@ -74,6 +78,60 @@ export class BlockAlreadyCheckpointedError extends Error {
|
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
|
|
81
|
+
/** Thrown when logs are added for a tag whose last stored log has a higher block number than the new log. */
|
|
82
|
+
export class OutOfOrderLogInsertionError extends Error {
|
|
83
|
+
constructor(
|
|
84
|
+
public readonly logType: 'private' | 'public',
|
|
85
|
+
public readonly tag: string,
|
|
86
|
+
public readonly lastBlockNumber: number,
|
|
87
|
+
public readonly newBlockNumber: number,
|
|
88
|
+
) {
|
|
89
|
+
super(
|
|
90
|
+
`Out-of-order ${logType} log insertion for tag ${tag}: ` +
|
|
91
|
+
`last existing log is from block ${lastBlockNumber} but new log is from block ${newBlockNumber}`,
|
|
92
|
+
);
|
|
93
|
+
this.name = 'OutOfOrderLogInsertionError';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Thrown when L1 to L2 messages are requested for a checkpoint whose message tree hasn't been sealed yet. */
|
|
98
|
+
export class L1ToL2MessagesNotReadyError extends Error {
|
|
99
|
+
constructor(
|
|
100
|
+
public readonly checkpointNumber: number,
|
|
101
|
+
public readonly inboxTreeInProgress: bigint,
|
|
102
|
+
) {
|
|
103
|
+
super(
|
|
104
|
+
`Cannot get L1 to L2 messages for checkpoint ${checkpointNumber}: ` +
|
|
105
|
+
`inbox tree in progress is ${inboxTreeInProgress}, messages not yet sealed`,
|
|
106
|
+
);
|
|
107
|
+
this.name = 'L1ToL2MessagesNotReadyError';
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Thrown when a proposed checkpoint number is stale (already processed). */
|
|
112
|
+
export class ProposedCheckpointStaleError extends Error {
|
|
113
|
+
constructor(
|
|
114
|
+
public readonly proposedCheckpointNumber: number,
|
|
115
|
+
public readonly currentProposedNumber: number,
|
|
116
|
+
) {
|
|
117
|
+
super(`Stale proposed checkpoint ${proposedCheckpointNumber}: current proposed is ${currentProposedNumber}`);
|
|
118
|
+
this.name = 'ProposedCheckpointStaleError';
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Thrown when a proposed checkpoint number is not the expected confirmed + 1. */
|
|
123
|
+
export class ProposedCheckpointNotSequentialError extends Error {
|
|
124
|
+
constructor(
|
|
125
|
+
public readonly proposedCheckpointNumber: number,
|
|
126
|
+
public readonly confirmedCheckpointNumber: number,
|
|
127
|
+
) {
|
|
128
|
+
super(
|
|
129
|
+
`Proposed checkpoint ${proposedCheckpointNumber} is not sequential: expected ${confirmedCheckpointNumber + 1} (confirmed + 1)`,
|
|
130
|
+
);
|
|
131
|
+
this.name = 'ProposedCheckpointNotSequentialError';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
77
135
|
/** Thrown when a proposed block conflicts with an already checkpointed block (different content). */
|
|
78
136
|
export class CannotOverwriteCheckpointedBlockError extends Error {
|
|
79
137
|
constructor(
|
package/src/factory.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
2
2
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
3
|
+
import { makeL1HttpTransport } from '@aztec/ethereum/client';
|
|
3
4
|
import { InboxContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
4
5
|
import type { ViemPublicDebugClient } from '@aztec/ethereum/types';
|
|
5
6
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
@@ -12,12 +13,12 @@ import { protocolContractNames } from '@aztec/protocol-contracts';
|
|
|
12
13
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
13
14
|
import { FunctionType, decodeFunctionSignature } from '@aztec/stdlib/abi';
|
|
14
15
|
import type { ArchiverEmitter } from '@aztec/stdlib/block';
|
|
15
|
-
import { type
|
|
16
|
+
import { type ContractClassPublicWithCommitment, computePublicBytecodeCommitment } from '@aztec/stdlib/contract';
|
|
16
17
|
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
17
18
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
18
19
|
|
|
19
20
|
import { EventEmitter } from 'events';
|
|
20
|
-
import { createPublicClient
|
|
21
|
+
import { createPublicClient } from 'viem';
|
|
21
22
|
|
|
22
23
|
import { Archiver, type ArchiverDeps } from './archiver.js';
|
|
23
24
|
import { type ArchiverConfig, mapArchiverConfig } from './config.js';
|
|
@@ -57,9 +58,10 @@ export async function createArchiver(
|
|
|
57
58
|
|
|
58
59
|
// Create Ethereum clients
|
|
59
60
|
const chain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
|
|
61
|
+
const httpTimeout = config.l1HttpTimeoutMS;
|
|
60
62
|
const publicClient = createPublicClient({
|
|
61
63
|
chain: chain.chainInfo,
|
|
62
|
-
transport:
|
|
64
|
+
transport: makeL1HttpTransport(config.l1RpcUrls, { timeout: httpTimeout }),
|
|
63
65
|
pollingInterval: config.viemPollingIntervalMS,
|
|
64
66
|
});
|
|
65
67
|
|
|
@@ -67,7 +69,7 @@ export async function createArchiver(
|
|
|
67
69
|
const debugRpcUrls = config.l1DebugRpcUrls.length > 0 ? config.l1DebugRpcUrls : config.l1RpcUrls;
|
|
68
70
|
const debugClient = createPublicClient({
|
|
69
71
|
chain: chain.chainInfo,
|
|
70
|
-
transport:
|
|
72
|
+
transport: makeL1HttpTransport(debugRpcUrls, { timeout: httpTimeout }),
|
|
71
73
|
pollingInterval: config.viemPollingIntervalMS,
|
|
72
74
|
}) as ViemPublicDebugClient;
|
|
73
75
|
|
|
@@ -171,16 +173,22 @@ export async function createArchiver(
|
|
|
171
173
|
return archiver;
|
|
172
174
|
}
|
|
173
175
|
|
|
174
|
-
/** Registers protocol contracts in the archiver store. */
|
|
176
|
+
/** Registers protocol contracts in the archiver store. Idempotent — skips contracts that already exist (e.g. on node restart). */
|
|
175
177
|
export async function registerProtocolContracts(store: KVArchiverDataStore) {
|
|
176
178
|
const blockNumber = 0;
|
|
177
179
|
for (const name of protocolContractNames) {
|
|
178
180
|
const provider = new BundledProtocolContractsProvider();
|
|
179
181
|
const contract = await provider.getProtocolContractArtifact(name);
|
|
180
|
-
|
|
182
|
+
|
|
183
|
+
// Skip if already registered (happens on node restart with a persisted store).
|
|
184
|
+
if (await store.getContractClass(contract.contractClass.id)) {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const publicBytecodeCommitment = await computePublicBytecodeCommitment(contract.contractClass.packedBytecode);
|
|
189
|
+
const contractClassPublic: ContractClassPublicWithCommitment = {
|
|
181
190
|
...contract.contractClass,
|
|
182
|
-
|
|
183
|
-
utilityFunctions: [],
|
|
191
|
+
publicBytecodeCommitment,
|
|
184
192
|
};
|
|
185
193
|
|
|
186
194
|
const publicFunctionSignatures = contract.artifact.functions
|
|
@@ -188,8 +196,7 @@ export async function registerProtocolContracts(store: KVArchiverDataStore) {
|
|
|
188
196
|
.map(fn => decodeFunctionSignature(fn.name, fn.parameters));
|
|
189
197
|
|
|
190
198
|
await store.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
191
|
-
|
|
192
|
-
await store.addContractClasses([contractClassPublic], [bytecodeCommitment], BlockNumber(blockNumber));
|
|
199
|
+
await store.addContractClasses([contractClassPublic], BlockNumber(blockNumber));
|
|
193
200
|
await store.addContractInstances([contract.instance], BlockNumber(blockNumber));
|
|
194
201
|
}
|
|
195
202
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MULTI_CALL_3_ADDRESS, type ViemCommitteeAttestations, type ViemHeader } from '@aztec/ethereum/contracts';
|
|
2
2
|
import type { ViemPublicClient, ViemPublicDebugClient } from '@aztec/ethereum/types';
|
|
3
3
|
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
4
|
+
import { LruSet } from '@aztec/foundation/collection';
|
|
4
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
6
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
7
|
import type { Logger } from '@aztec/foundation/log';
|
|
@@ -44,7 +45,7 @@ type CheckpointData = {
|
|
|
44
45
|
*/
|
|
45
46
|
export class CalldataRetriever {
|
|
46
47
|
/** Tx hashes we've already logged for trace+debug failure (log once per tx per process). */
|
|
47
|
-
private static readonly traceFailureWarnedTxHashes = new
|
|
48
|
+
private static readonly traceFailureWarnedTxHashes = new LruSet<string>(1000);
|
|
48
49
|
|
|
49
50
|
/** Clears the trace-failure warned set. For testing only. */
|
|
50
51
|
static resetTraceFailureWarnedForTesting(): void {
|
package/src/l1/data_retrieval.ts
CHANGED
|
@@ -144,7 +144,7 @@ export async function retrievedToPublishedCheckpoint({
|
|
|
144
144
|
* @param blobClient - The blob client client for fetching blob data.
|
|
145
145
|
* @param searchStartBlock - The block number to use for starting the search.
|
|
146
146
|
* @param searchEndBlock - The highest block number that we should search up to.
|
|
147
|
-
* @param contractAddresses - The contract addresses (governanceProposerAddress,
|
|
147
|
+
* @param contractAddresses - The contract addresses (governanceProposerAddress, slashingProposerAddress).
|
|
148
148
|
* @param instrumentation - The archiver instrumentation instance.
|
|
149
149
|
* @param logger - The logger instance.
|
|
150
150
|
* @param isHistoricalSync - Whether this is a historical sync.
|
|
@@ -344,14 +344,10 @@ export async function getCheckpointBlobDataFromBlobs(
|
|
|
344
344
|
/** Given an L1 to L2 message, retrieves its corresponding event from the Inbox within a specific block range. */
|
|
345
345
|
export async function retrieveL1ToL2Message(
|
|
346
346
|
inbox: InboxContract,
|
|
347
|
-
|
|
348
|
-
fromBlock: bigint,
|
|
349
|
-
toBlock: bigint,
|
|
347
|
+
message: InboxMessage,
|
|
350
348
|
): Promise<InboxMessage | undefined> {
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
const messages = mapLogsInboxMessage(logs);
|
|
354
|
-
return messages.length > 0 ? messages[0] : undefined;
|
|
349
|
+
const log = await inbox.getMessageSentEventByHash(message.leaf.toString(), message.l1BlockHash.toString());
|
|
350
|
+
return log && mapLogInboxMessage(log);
|
|
355
351
|
}
|
|
356
352
|
|
|
357
353
|
/**
|
|
@@ -374,22 +370,22 @@ export async function retrieveL1ToL2Messages(
|
|
|
374
370
|
break;
|
|
375
371
|
}
|
|
376
372
|
|
|
377
|
-
retrievedL1ToL2Messages.push(...
|
|
373
|
+
retrievedL1ToL2Messages.push(...messageSentLogs.map(mapLogInboxMessage));
|
|
378
374
|
searchStartBlock = messageSentLogs.at(-1)!.l1BlockNumber + 1n;
|
|
379
375
|
}
|
|
380
376
|
|
|
381
377
|
return retrievedL1ToL2Messages;
|
|
382
378
|
}
|
|
383
379
|
|
|
384
|
-
function
|
|
385
|
-
return
|
|
380
|
+
function mapLogInboxMessage(log: MessageSentLog): InboxMessage {
|
|
381
|
+
return {
|
|
386
382
|
index: log.args.index,
|
|
387
383
|
leaf: log.args.leaf,
|
|
388
384
|
l1BlockNumber: log.l1BlockNumber,
|
|
389
385
|
l1BlockHash: log.l1BlockHash,
|
|
390
386
|
checkpointNumber: log.args.checkpointNumber,
|
|
391
387
|
rollingHash: log.args.rollingHash,
|
|
392
|
-
}
|
|
388
|
+
};
|
|
393
389
|
}
|
|
394
390
|
|
|
395
391
|
/** Retrieves L2ProofVerified events from the rollup contract. */
|
|
@@ -6,7 +6,13 @@ import { isDefined } from '@aztec/foundation/types';
|
|
|
6
6
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
7
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
8
|
import { type BlockData, type BlockHash, CheckpointedL2Block, L2Block, type L2Tips } from '@aztec/stdlib/block';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
Checkpoint,
|
|
11
|
+
type CheckpointData,
|
|
12
|
+
type CommonCheckpointData,
|
|
13
|
+
type ProposedCheckpointData,
|
|
14
|
+
PublishedCheckpoint,
|
|
15
|
+
} from '@aztec/stdlib/checkpoint';
|
|
10
16
|
import type { ContractClassPublic, ContractDataSource, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
11
17
|
import { type L1RollupConstants, getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
|
|
12
18
|
import type { GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
|
|
@@ -157,6 +163,14 @@ export abstract class ArchiverDataSourceBase
|
|
|
157
163
|
return this.store.getSettledTxReceipt(txHash, this.l1Constants);
|
|
158
164
|
}
|
|
159
165
|
|
|
166
|
+
public getProposedCheckpoint(): Promise<CommonCheckpointData | undefined> {
|
|
167
|
+
return this.store.getProposedCheckpoint();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public getProposedCheckpointOnly(): Promise<ProposedCheckpointData | undefined> {
|
|
171
|
+
return this.store.getProposedCheckpointOnly();
|
|
172
|
+
}
|
|
173
|
+
|
|
160
174
|
public isPendingChainInvalid(): Promise<boolean> {
|
|
161
175
|
return this.getPendingChainValidationStatus().then(status => !status.valid);
|
|
162
176
|
}
|
|
@@ -165,16 +179,21 @@ export abstract class ArchiverDataSourceBase
|
|
|
165
179
|
return (await this.store.getPendingChainValidationStatus()) ?? { valid: true };
|
|
166
180
|
}
|
|
167
181
|
|
|
168
|
-
public getPrivateLogsByTags(
|
|
169
|
-
|
|
182
|
+
public getPrivateLogsByTags(
|
|
183
|
+
tags: SiloedTag[],
|
|
184
|
+
page?: number,
|
|
185
|
+
upToBlockNumber?: BlockNumber,
|
|
186
|
+
): Promise<TxScopedL2Log[][]> {
|
|
187
|
+
return this.store.getPrivateLogsByTags(tags, page, upToBlockNumber);
|
|
170
188
|
}
|
|
171
189
|
|
|
172
190
|
public getPublicLogsByTagsFromContract(
|
|
173
191
|
contractAddress: AztecAddress,
|
|
174
192
|
tags: Tag[],
|
|
175
193
|
page?: number,
|
|
194
|
+
upToBlockNumber?: BlockNumber,
|
|
176
195
|
): Promise<TxScopedL2Log[][]> {
|
|
177
|
-
return this.store.getPublicLogsByTagsFromContract(contractAddress, tags, page);
|
|
196
|
+
return this.store.getPublicLogsByTagsFromContract(contractAddress, tags, page, upToBlockNumber);
|
|
178
197
|
}
|
|
179
198
|
|
|
180
199
|
public getPublicLogs(filter: LogFilter): Promise<GetPublicLogsResponse> {
|