@aztec/archiver 3.0.0-nightly.20251202 → 3.0.0-nightly.20251204
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/archiver.d.ts +25 -23
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +32 -19
- package/dest/archiver/archiver_store.d.ts +16 -15
- package/dest/archiver/archiver_store.d.ts.map +1 -1
- package/dest/archiver/archiver_store_test_suite.d.ts +1 -1
- package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -1
- package/dest/archiver/archiver_store_test_suite.js +81 -81
- package/dest/archiver/data_retrieval.d.ts +1 -1
- package/dest/archiver/data_retrieval.d.ts.map +1 -1
- package/dest/archiver/data_retrieval.js +2 -2
- package/dest/archiver/kv_archiver_store/block_store.d.ts +9 -8
- package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/block_store.js +8 -7
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +17 -16
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/log_store.d.ts +1 -1
- package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/log_store.js +3 -2
- package/dest/archiver/structs/inbox_message.d.ts +3 -3
- package/dest/archiver/structs/inbox_message.d.ts.map +1 -1
- package/dest/archiver/structs/inbox_message.js +2 -1
- package/dest/factory.d.ts +1 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +3 -2
- package/dest/test/mock_archiver.d.ts +3 -1
- package/dest/test/mock_archiver.d.ts.map +1 -1
- package/dest/test/mock_archiver.js +4 -0
- package/dest/test/mock_l1_to_l2_message_source.d.ts +4 -2
- package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/test/mock_l1_to_l2_message_source.js +7 -2
- package/dest/test/mock_l2_block_source.d.ts +8 -5
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +15 -6
- package/dest/test/mock_structs.d.ts +1 -1
- package/dest/test/mock_structs.d.ts.map +1 -1
- package/dest/test/mock_structs.js +3 -2
- package/package.json +13 -13
- package/src/archiver/archiver.ts +58 -53
- package/src/archiver/archiver_store.ts +19 -14
- package/src/archiver/archiver_store_test_suite.ts +107 -76
- package/src/archiver/data_retrieval.ts +2 -2
- package/src/archiver/kv_archiver_store/block_store.ts +17 -16
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +16 -15
- package/src/archiver/kv_archiver_store/log_store.ts +3 -2
- package/src/archiver/structs/inbox_message.ts +4 -4
- package/src/factory.ts +3 -2
- package/src/test/mock_archiver.ts +6 -0
- package/src/test/mock_l1_to_l2_message_source.ts +9 -3
- package/src/test/mock_l2_block_source.ts +19 -8
- package/src/test/mock_structs.ts +3 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
|
|
2
2
|
import { DefaultL1ContractsConfig } from '@aztec/ethereum';
|
|
3
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
4
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
4
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
6
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -17,7 +18,7 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
17
18
|
async createBlocks(numBlocks) {
|
|
18
19
|
for(let i = 0; i < numBlocks; i++){
|
|
19
20
|
const blockNum = this.l2Blocks.length + 1;
|
|
20
|
-
const block = await L2Block.random(blockNum);
|
|
21
|
+
const block = await L2Block.random(BlockNumber(blockNum));
|
|
21
22
|
this.l2Blocks.push(block);
|
|
22
23
|
}
|
|
23
24
|
this.log.verbose(`Created ${numBlocks} blocks in the mock L2 block source`);
|
|
@@ -55,10 +56,10 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
55
56
|
* Gets the number of the latest L2 block processed by the block source implementation.
|
|
56
57
|
* @returns In this mock instance, returns the number of L2 blocks that we've mocked.
|
|
57
58
|
*/ getBlockNumber() {
|
|
58
|
-
return Promise.resolve(this.l2Blocks.length);
|
|
59
|
+
return Promise.resolve(BlockNumber(this.l2Blocks.length));
|
|
59
60
|
}
|
|
60
61
|
getProvenBlockNumber() {
|
|
61
|
-
return Promise.resolve(this.provenBlockNumber);
|
|
62
|
+
return Promise.resolve(BlockNumber(this.provenBlockNumber));
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
64
65
|
* Gets an l2 block.
|
|
@@ -75,6 +76,10 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
75
76
|
*/ getBlocks(from, limit, proven) {
|
|
76
77
|
return Promise.resolve(this.l2Blocks.slice(from - 1, from - 1 + limit).filter((b)=>!proven || this.provenBlockNumber === undefined || b.number <= this.provenBlockNumber));
|
|
77
78
|
}
|
|
79
|
+
async getPublishedCheckpoints(from, limit) {
|
|
80
|
+
// TODO: Implement this properly. This only works when we have one block per checkpoint.
|
|
81
|
+
return (await this.getPublishedBlocks(from, limit)).map((block)=>block.toPublishedCheckpoint());
|
|
82
|
+
}
|
|
78
83
|
async getPublishedBlocks(from, limit, proven) {
|
|
79
84
|
const blocks = await this.getBlocks(from, limit, proven);
|
|
80
85
|
return blocks.map((block)=>PublishedL2Block.fromFields({
|
|
@@ -135,6 +140,10 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
135
140
|
getBlockHeader(number) {
|
|
136
141
|
return Promise.resolve(this.l2Blocks.at(typeof number === 'number' ? number - 1 : -1)?.getBlockHeader());
|
|
137
142
|
}
|
|
143
|
+
getCheckpointsForEpoch(epochNumber) {
|
|
144
|
+
// TODO: Implement this properly. This only works when we have one block per checkpoint.
|
|
145
|
+
return this.getBlocksForEpoch(epochNumber).then((blocks)=>blocks.map((b)=>b.toCheckpoint()));
|
|
146
|
+
}
|
|
138
147
|
getBlocksForEpoch(epochNumber) {
|
|
139
148
|
const epochDuration = DefaultL1ContractsConfig.aztecEpochDuration;
|
|
140
149
|
const [start, end] = getSlotRangeForEpoch(epochNumber, {
|
|
@@ -195,15 +204,15 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
195
204
|
const finalizedBlock = this.l2Blocks[finalized - 1];
|
|
196
205
|
return {
|
|
197
206
|
latest: {
|
|
198
|
-
number: latest,
|
|
207
|
+
number: BlockNumber(latest),
|
|
199
208
|
hash: (await latestBlock?.hash())?.toString()
|
|
200
209
|
},
|
|
201
210
|
proven: {
|
|
202
|
-
number: proven,
|
|
211
|
+
number: BlockNumber(proven),
|
|
203
212
|
hash: (await provenBlock?.hash())?.toString()
|
|
204
213
|
},
|
|
205
214
|
finalized: {
|
|
206
|
-
number: finalized,
|
|
215
|
+
number: BlockNumber(finalized),
|
|
207
216
|
hash: (await finalizedBlock?.hash())?.toString()
|
|
208
217
|
}
|
|
209
218
|
};
|
|
@@ -6,4 +6,4 @@ export declare function makeInboxMessages(count: number, opts?: {
|
|
|
6
6
|
initialL2BlockNumber?: number;
|
|
7
7
|
overrideFn?: (msg: InboxMessage, index: number) => InboxMessage;
|
|
8
8
|
}): InboxMessage[];
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9ja19zdHJ1Y3RzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdC9tb2NrX3N0cnVjdHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLFFBQVEsRUFBWSxNQUFNLDBCQUEwQixDQUFDO0FBSzlELE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBcUIsTUFBTSxzQ0FBc0MsQ0FBQztBQUU1Rix3QkFBZ0IsZ0JBQWdCLENBQzlCLG1CQUFtQixXQUFnQixFQUNuQyxTQUFTLEdBQUUsT0FBTyxDQUFDLFlBQVksQ0FBTSxHQUNwQyxZQUFZLENBZ0JkO0FBRUQsd0JBQWdCLGlCQUFpQixDQUMvQixLQUFLLEVBQUUsTUFBTSxFQUNiLElBQUksR0FBRTtJQUNKLFdBQVcsQ0FBQyxFQUFFLFFBQVEsQ0FBQztJQUN2QixvQkFBb0IsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUM5QixVQUFVLENBQUMsRUFBRSxDQUFDLEdBQUcsRUFBRSxZQUFZLEVBQUUsS0FBSyxFQUFFLE1BQU0sS0FBSyxZQUFZLENBQUM7Q0FDNUQsR0FDTCxZQUFZLEVBQUUsQ0FhaEIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock_structs.d.ts","sourceRoot":"","sources":["../../src/test/mock_structs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mock_structs.d.ts","sourceRoot":"","sources":["../../src/test/mock_structs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAK9D,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,sCAAsC,CAAC;AAE5F,wBAAgB,gBAAgB,CAC9B,mBAAmB,WAAgB,EACnC,SAAS,GAAE,OAAO,CAAC,YAAY,CAAM,GACpC,YAAY,CAgBd;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;IACJ,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;CAC5D,GACL,YAAY,EAAE,CAahB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { Buffer16, Buffer32 } from '@aztec/foundation/buffer';
|
|
2
3
|
import { randomBigInt, randomInt } from '@aztec/foundation/crypto';
|
|
3
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -13,7 +14,7 @@ export function makeInboxMessage(previousRollingHash = Buffer16.ZERO, overrides
|
|
|
13
14
|
return {
|
|
14
15
|
index,
|
|
15
16
|
leaf,
|
|
16
|
-
l2BlockNumber,
|
|
17
|
+
l2BlockNumber: BlockNumber(l2BlockNumber),
|
|
17
18
|
l1BlockNumber,
|
|
18
19
|
l1BlockHash,
|
|
19
20
|
rollingHash
|
|
@@ -25,7 +26,7 @@ export function makeInboxMessages(count, opts = {}) {
|
|
|
25
26
|
let rollingHash = initialHash;
|
|
26
27
|
for(let i = 0; i < count; i++){
|
|
27
28
|
const leaf = Fr.random();
|
|
28
|
-
const l2BlockNumber = i + initialL2BlockNumber;
|
|
29
|
+
const l2BlockNumber = BlockNumber(i + initialL2BlockNumber);
|
|
29
30
|
const message = overrideFn(makeInboxMessage(rollingHash, {
|
|
30
31
|
leaf,
|
|
31
32
|
l2BlockNumber
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/archiver",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251204",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -66,18 +66,18 @@
|
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
70
|
-
"@aztec/blob-sink": "3.0.0-nightly.
|
|
71
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
72
|
-
"@aztec/epoch-cache": "3.0.0-nightly.
|
|
73
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
74
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
75
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
76
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
77
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
78
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
79
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
80
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
69
|
+
"@aztec/blob-lib": "3.0.0-nightly.20251204",
|
|
70
|
+
"@aztec/blob-sink": "3.0.0-nightly.20251204",
|
|
71
|
+
"@aztec/constants": "3.0.0-nightly.20251204",
|
|
72
|
+
"@aztec/epoch-cache": "3.0.0-nightly.20251204",
|
|
73
|
+
"@aztec/ethereum": "3.0.0-nightly.20251204",
|
|
74
|
+
"@aztec/foundation": "3.0.0-nightly.20251204",
|
|
75
|
+
"@aztec/kv-store": "3.0.0-nightly.20251204",
|
|
76
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251204",
|
|
77
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251204",
|
|
78
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251204",
|
|
79
|
+
"@aztec/stdlib": "3.0.0-nightly.20251204",
|
|
80
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20251204",
|
|
81
81
|
"lodash.groupby": "^4.6.0",
|
|
82
82
|
"lodash.omit": "^4.5.0",
|
|
83
83
|
"tslib": "^2.5.0",
|
package/src/archiver/archiver.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BlobSinkClientInterface } from '@aztec/blob-sink/client';
|
|
2
|
+
import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
|
|
2
3
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
3
4
|
import {
|
|
4
5
|
BlockTagTooOldError,
|
|
@@ -9,7 +10,7 @@ import {
|
|
|
9
10
|
createEthereumChain,
|
|
10
11
|
} from '@aztec/ethereum';
|
|
11
12
|
import { maxBigint } from '@aztec/foundation/bigint';
|
|
12
|
-
import { CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
13
|
+
import { BlockNumber, CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
13
14
|
import { Buffer16, Buffer32 } from '@aztec/foundation/buffer';
|
|
14
15
|
import { merge, pick } from '@aztec/foundation/collection';
|
|
15
16
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
@@ -35,7 +36,6 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
35
36
|
import {
|
|
36
37
|
type ArchiverEmitter,
|
|
37
38
|
L2Block,
|
|
38
|
-
type L2BlockId,
|
|
39
39
|
type L2BlockSource,
|
|
40
40
|
L2BlockSourceEvents,
|
|
41
41
|
type L2Tips,
|
|
@@ -747,7 +747,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
747
747
|
|
|
748
748
|
this.emit(L2BlockSourceEvents.L2BlockProven, {
|
|
749
749
|
type: L2BlockSourceEvents.L2BlockProven,
|
|
750
|
-
blockNumber:
|
|
750
|
+
blockNumber: lastProvenBlockNumber,
|
|
751
751
|
slotNumber: provenSlotNumber,
|
|
752
752
|
epochNumber: provenEpochNumber,
|
|
753
753
|
});
|
|
@@ -940,7 +940,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
940
940
|
if (err instanceof InitialBlockNumberNotSequentialError) {
|
|
941
941
|
const { previousBlockNumber, newBlockNumber } = err;
|
|
942
942
|
const previousBlock = previousBlockNumber
|
|
943
|
-
? await this.store.getPublishedBlock(previousBlockNumber)
|
|
943
|
+
? await this.store.getPublishedBlock(BlockNumber(previousBlockNumber))
|
|
944
944
|
: undefined;
|
|
945
945
|
const updatedL1SyncPoint = previousBlock?.l1.blockNumber ?? this.l1constants.l1StartBlock;
|
|
946
946
|
await this.store.setBlockSynchedL1BlockNumber(updatedL1SyncPoint);
|
|
@@ -1094,7 +1094,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1094
1094
|
if (slot(block) <= end) {
|
|
1095
1095
|
blocks.push(block);
|
|
1096
1096
|
}
|
|
1097
|
-
block = await this.getBlock(block.number - 1);
|
|
1097
|
+
block = await this.getBlock(BlockNumber(block.number - 1));
|
|
1098
1098
|
}
|
|
1099
1099
|
|
|
1100
1100
|
return blocks.reverse();
|
|
@@ -1113,7 +1113,8 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1113
1113
|
if (slot(header) <= end) {
|
|
1114
1114
|
blocks.push(header);
|
|
1115
1115
|
}
|
|
1116
|
-
|
|
1116
|
+
number = BlockNumber(number - 1);
|
|
1117
|
+
header = await this.getBlockHeader(number);
|
|
1117
1118
|
}
|
|
1118
1119
|
return blocks.reverse();
|
|
1119
1120
|
}
|
|
@@ -1157,7 +1158,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1157
1158
|
proven?: boolean,
|
|
1158
1159
|
): Promise<PublishedCheckpoint[]> {
|
|
1159
1160
|
// TODO: Implement this properly. This only works when we have one block per checkpoint.
|
|
1160
|
-
const blocks = await this.getPublishedBlocks(from, limit, proven);
|
|
1161
|
+
const blocks = await this.getPublishedBlocks(BlockNumber(from), limit, proven);
|
|
1161
1162
|
return blocks.map(b => b.toPublishedCheckpoint());
|
|
1162
1163
|
}
|
|
1163
1164
|
|
|
@@ -1207,19 +1208,19 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1207
1208
|
public setProvenCheckpointNumber(checkpointNumber: CheckpointNumber): Promise<void> {
|
|
1208
1209
|
// TODO: Create store and apis for checkpoints.
|
|
1209
1210
|
// Proven checkpoint number will no longer be the same as the proven block number once we support multiple blocks per checkpoint.
|
|
1210
|
-
return this.store.setProvenL2BlockNumber(checkpointNumber);
|
|
1211
|
+
return this.store.setProvenL2BlockNumber(BlockNumber.fromCheckpointNumber(checkpointNumber));
|
|
1211
1212
|
}
|
|
1212
1213
|
|
|
1213
1214
|
public unwindCheckpoints(from: CheckpointNumber, checkpointsToUnwind: number): Promise<boolean> {
|
|
1214
1215
|
// TODO: Create store and apis for checkpoints.
|
|
1215
1216
|
// This only works when we have one block per checkpoint.
|
|
1216
|
-
return this.store.unwindBlocks(from, checkpointsToUnwind);
|
|
1217
|
+
return this.store.unwindBlocks(BlockNumber.fromCheckpointNumber(from), checkpointsToUnwind);
|
|
1217
1218
|
}
|
|
1218
1219
|
|
|
1219
|
-
public getLastBlockNumberInCheckpoint(checkpointNumber: CheckpointNumber): Promise<
|
|
1220
|
+
public getLastBlockNumberInCheckpoint(checkpointNumber: CheckpointNumber): Promise<BlockNumber> {
|
|
1220
1221
|
// TODO: Create store and apis for checkpoints.
|
|
1221
1222
|
// Checkpoint number will no longer be the same as the block number once we support multiple blocks per checkpoint.
|
|
1222
|
-
return Promise.resolve(checkpointNumber);
|
|
1223
|
+
return Promise.resolve(BlockNumber.fromCheckpointNumber(checkpointNumber));
|
|
1223
1224
|
}
|
|
1224
1225
|
|
|
1225
1226
|
public addCheckpoints(
|
|
@@ -1234,6 +1235,19 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1234
1235
|
);
|
|
1235
1236
|
}
|
|
1236
1237
|
|
|
1238
|
+
public async getCheckpointsForEpoch(epochNumber: EpochNumber): Promise<Checkpoint[]> {
|
|
1239
|
+
// TODO: Create store and apis for checkpoints.
|
|
1240
|
+
// This only works when we have one block per checkpoint.
|
|
1241
|
+
const blocks = await this.getBlocksForEpoch(epochNumber);
|
|
1242
|
+
return blocks.map(b => b.toCheckpoint());
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
public getL1ToL2MessagesForCheckpoint(checkpointNumber: CheckpointNumber): Promise<Fr[]> {
|
|
1246
|
+
// TODO: Create dedicated api for checkpoints.
|
|
1247
|
+
// This only works when we have one block per checkpoint.
|
|
1248
|
+
return this.getL1ToL2Messages(BlockNumber.fromCheckpointNumber(checkpointNumber));
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1237
1251
|
/**
|
|
1238
1252
|
* Gets up to `limit` amount of L2 blocks starting from `from`.
|
|
1239
1253
|
* @param from - Number of the first block to return (inclusive).
|
|
@@ -1241,12 +1255,12 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1241
1255
|
* @param proven - If true, only return blocks that have been proven.
|
|
1242
1256
|
* @returns The requested L2 blocks.
|
|
1243
1257
|
*/
|
|
1244
|
-
public getBlocks(from:
|
|
1258
|
+
public getBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<L2Block[]> {
|
|
1245
1259
|
return this.getPublishedBlocks(from, limit, proven).then(blocks => blocks.map(b => b.block));
|
|
1246
1260
|
}
|
|
1247
1261
|
|
|
1248
1262
|
/** Equivalent to getBlocks but includes publish data. */
|
|
1249
|
-
public async getPublishedBlocks(from:
|
|
1263
|
+
public async getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<PublishedL2Block[]> {
|
|
1250
1264
|
const limitWithProven = proven
|
|
1251
1265
|
? Math.min(limit, Math.max((await this.store.getProvenL2BlockNumber()) - from + 1, 0))
|
|
1252
1266
|
: limit;
|
|
@@ -1274,7 +1288,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1274
1288
|
* @param number - The block number to return.
|
|
1275
1289
|
* @returns The requested L2 block.
|
|
1276
1290
|
*/
|
|
1277
|
-
public async getBlock(number:
|
|
1291
|
+
public async getBlock(number: BlockNumber): Promise<L2Block | undefined> {
|
|
1278
1292
|
// If the number provided is -ve, then return the latest block.
|
|
1279
1293
|
if (number < 0) {
|
|
1280
1294
|
number = await this.store.getSynchedL2BlockNumber();
|
|
@@ -1286,7 +1300,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1286
1300
|
return publishedBlock?.block;
|
|
1287
1301
|
}
|
|
1288
1302
|
|
|
1289
|
-
public async getBlockHeader(number:
|
|
1303
|
+
public async getBlockHeader(number: BlockNumber | 'latest'): Promise<BlockHeader | undefined> {
|
|
1290
1304
|
if (number === 'latest') {
|
|
1291
1305
|
number = await this.store.getSynchedL2BlockNumber();
|
|
1292
1306
|
}
|
|
@@ -1311,7 +1325,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1311
1325
|
* @param limit - The maximum number of blocks to retrieve logs from.
|
|
1312
1326
|
* @returns An array of private logs from the specified range of blocks.
|
|
1313
1327
|
*/
|
|
1314
|
-
public getPrivateLogs(from:
|
|
1328
|
+
public getPrivateLogs(from: BlockNumber, limit: number): Promise<PrivateLog[]> {
|
|
1315
1329
|
return this.store.getPrivateLogs(from, limit);
|
|
1316
1330
|
}
|
|
1317
1331
|
|
|
@@ -1347,16 +1361,16 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1347
1361
|
* Gets the number of the latest L2 block processed by the block source implementation.
|
|
1348
1362
|
* @returns The number of the latest L2 block processed by the block source implementation.
|
|
1349
1363
|
*/
|
|
1350
|
-
public getBlockNumber(): Promise<
|
|
1364
|
+
public getBlockNumber(): Promise<BlockNumber> {
|
|
1351
1365
|
return this.store.getSynchedL2BlockNumber();
|
|
1352
1366
|
}
|
|
1353
1367
|
|
|
1354
|
-
public getProvenBlockNumber(): Promise<
|
|
1368
|
+
public getProvenBlockNumber(): Promise<BlockNumber> {
|
|
1355
1369
|
return this.store.getProvenL2BlockNumber();
|
|
1356
1370
|
}
|
|
1357
1371
|
|
|
1358
1372
|
/** Forcefully updates the last proven block number. Use for testing. */
|
|
1359
|
-
public setProvenBlockNumber(blockNumber:
|
|
1373
|
+
public setProvenBlockNumber(blockNumber: BlockNumber): Promise<void> {
|
|
1360
1374
|
return this.store.setProvenL2BlockNumber(blockNumber);
|
|
1361
1375
|
}
|
|
1362
1376
|
|
|
@@ -1389,7 +1403,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1389
1403
|
* @param blockNumber - L2 block number to get messages for.
|
|
1390
1404
|
* @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
|
|
1391
1405
|
*/
|
|
1392
|
-
getL1ToL2Messages(blockNumber:
|
|
1406
|
+
getL1ToL2Messages(blockNumber: BlockNumber): Promise<Fr[]> {
|
|
1393
1407
|
return this.store.getL1ToL2Messages(blockNumber);
|
|
1394
1408
|
}
|
|
1395
1409
|
|
|
@@ -1431,7 +1445,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1431
1445
|
// TODO(#13569): Compute proper finalized block number based on L1 finalized block.
|
|
1432
1446
|
// We just force it 2 epochs worth of proven data for now.
|
|
1433
1447
|
// NOTE: update end-to-end/src/e2e_epochs/epochs_empty_blocks.test.ts as that uses finalized blocks in computations
|
|
1434
|
-
const finalizedBlockNumber = Math.max(provenBlockNumber - this.l1constants.epochDuration * 2, 0);
|
|
1448
|
+
const finalizedBlockNumber = BlockNumber(Math.max(provenBlockNumber - this.l1constants.epochDuration * 2, 0));
|
|
1435
1449
|
|
|
1436
1450
|
const [latestBlockHeader, provenBlockHeader, finalizedBlockHeader] = await Promise.all([
|
|
1437
1451
|
latestBlockNumber > 0 ? this.getBlockHeader(latestBlockNumber) : undefined,
|
|
@@ -1455,27 +1469,18 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1455
1469
|
);
|
|
1456
1470
|
}
|
|
1457
1471
|
|
|
1458
|
-
const latestBlockHeaderHash = await latestBlockHeader?.hash();
|
|
1459
|
-
const provenBlockHeaderHash = await provenBlockHeader?.hash();
|
|
1460
|
-
const finalizedBlockHeaderHash = await finalizedBlockHeader?.hash();
|
|
1472
|
+
const latestBlockHeaderHash = (await latestBlockHeader?.hash()) ?? GENESIS_BLOCK_HEADER_HASH;
|
|
1473
|
+
const provenBlockHeaderHash = (await provenBlockHeader?.hash()) ?? GENESIS_BLOCK_HEADER_HASH;
|
|
1474
|
+
const finalizedBlockHeaderHash = (await finalizedBlockHeader?.hash()) ?? GENESIS_BLOCK_HEADER_HASH;
|
|
1461
1475
|
|
|
1462
1476
|
return {
|
|
1463
|
-
latest: {
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
} as L2BlockId,
|
|
1467
|
-
proven: {
|
|
1468
|
-
number: provenBlockNumber,
|
|
1469
|
-
hash: provenBlockHeaderHash?.toString(),
|
|
1470
|
-
} as L2BlockId,
|
|
1471
|
-
finalized: {
|
|
1472
|
-
number: finalizedBlockNumber,
|
|
1473
|
-
hash: finalizedBlockHeaderHash?.toString(),
|
|
1474
|
-
} as L2BlockId,
|
|
1477
|
+
latest: { number: latestBlockNumber, hash: latestBlockHeaderHash.toString() },
|
|
1478
|
+
proven: { number: provenBlockNumber, hash: provenBlockHeaderHash.toString() },
|
|
1479
|
+
finalized: { number: finalizedBlockNumber, hash: finalizedBlockHeaderHash.toString() },
|
|
1475
1480
|
};
|
|
1476
1481
|
}
|
|
1477
1482
|
|
|
1478
|
-
public async rollbackTo(targetL2BlockNumber:
|
|
1483
|
+
public async rollbackTo(targetL2BlockNumber: BlockNumber): Promise<void> {
|
|
1479
1484
|
const currentBlocks = await this.getL2Tips();
|
|
1480
1485
|
const currentL2Block = currentBlocks.latest.number;
|
|
1481
1486
|
const currentProvenBlock = currentBlocks.proven.number;
|
|
@@ -1492,7 +1497,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1492
1497
|
const targetL1BlockNumber = targetL2Block.l1.blockNumber;
|
|
1493
1498
|
const targetL1BlockHash = await this.getL1BlockHash(targetL1BlockNumber);
|
|
1494
1499
|
this.log.info(`Unwinding ${blocksToUnwind} blocks from L2 block ${currentL2Block}`);
|
|
1495
|
-
await this.store.unwindBlocks(currentL2Block, blocksToUnwind);
|
|
1500
|
+
await this.store.unwindBlocks(BlockNumber(currentL2Block), blocksToUnwind);
|
|
1496
1501
|
this.log.info(`Unwinding L1 to L2 messages to ${targetL2BlockNumber}`);
|
|
1497
1502
|
await this.store.rollbackL1ToL2MessagesToL2Block(targetL2BlockNumber);
|
|
1498
1503
|
this.log.info(`Setting L1 syncpoints to ${targetL1BlockNumber}`);
|
|
@@ -1500,7 +1505,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1500
1505
|
await this.store.setMessageSynchedL1Block({ l1BlockNumber: targetL1BlockNumber, l1BlockHash: targetL1BlockHash });
|
|
1501
1506
|
if (targetL2BlockNumber < currentProvenBlock) {
|
|
1502
1507
|
this.log.info(`Clearing proven L2 block number`);
|
|
1503
|
-
await this.store.setProvenL2BlockNumber(
|
|
1508
|
+
await this.store.setProvenL2BlockNumber(BlockNumber.ZERO);
|
|
1504
1509
|
}
|
|
1505
1510
|
// TODO(palla/reorg): Set the finalized block when we add support for it.
|
|
1506
1511
|
// if (targetL2BlockNumber < currentFinalizedBlock) {
|
|
@@ -1548,7 +1553,7 @@ export class ArchiverStoreHelper
|
|
|
1548
1553
|
* Extracts and stores contract classes out of ContractClassPublished events emitted by the class registry contract.
|
|
1549
1554
|
* @param allLogs - All logs emitted in a bunch of blocks.
|
|
1550
1555
|
*/
|
|
1551
|
-
async #updatePublishedContractClasses(allLogs: ContractClassLog[], blockNum:
|
|
1556
|
+
async #updatePublishedContractClasses(allLogs: ContractClassLog[], blockNum: BlockNumber, operation: Operation) {
|
|
1552
1557
|
const contractClassPublishedEvents = allLogs
|
|
1553
1558
|
.filter(log => ContractClassPublishedEvent.isContractClassPublishedEvent(log))
|
|
1554
1559
|
.map(log => ContractClassPublishedEvent.fromLog(log));
|
|
@@ -1573,7 +1578,7 @@ export class ArchiverStoreHelper
|
|
|
1573
1578
|
* Extracts and stores contract instances out of ContractInstancePublished events emitted by the canonical deployer contract.
|
|
1574
1579
|
* @param allLogs - All logs emitted in a bunch of blocks.
|
|
1575
1580
|
*/
|
|
1576
|
-
async #updateDeployedContractInstances(allLogs: PrivateLog[], blockNum:
|
|
1581
|
+
async #updateDeployedContractInstances(allLogs: PrivateLog[], blockNum: BlockNumber, operation: Operation) {
|
|
1577
1582
|
const contractInstances = allLogs
|
|
1578
1583
|
.filter(log => ContractInstancePublishedEvent.isContractInstancePublishedEvent(log))
|
|
1579
1584
|
.map(log => ContractInstancePublishedEvent.fromLog(log))
|
|
@@ -1626,7 +1631,7 @@ export class ArchiverStoreHelper
|
|
|
1626
1631
|
* @param _blockNum - The block number
|
|
1627
1632
|
* @returns
|
|
1628
1633
|
*/
|
|
1629
|
-
async #storeBroadcastedIndividualFunctions(allLogs: ContractClassLog[], _blockNum:
|
|
1634
|
+
async #storeBroadcastedIndividualFunctions(allLogs: ContractClassLog[], _blockNum: BlockNumber) {
|
|
1630
1635
|
// Filter out private and utility function broadcast events
|
|
1631
1636
|
const privateFnEvents = allLogs
|
|
1632
1637
|
.filter(log => PrivateFunctionBroadcastedEvent.isPrivateFunctionBroadcastedEvent(log))
|
|
@@ -1716,7 +1721,7 @@ export class ArchiverStoreHelper
|
|
|
1716
1721
|
});
|
|
1717
1722
|
}
|
|
1718
1723
|
|
|
1719
|
-
public async unwindBlocks(from:
|
|
1724
|
+
public async unwindBlocks(from: BlockNumber, blocksToUnwind: number): Promise<boolean> {
|
|
1720
1725
|
const last = await this.getSynchedL2BlockNumber();
|
|
1721
1726
|
if (from != last) {
|
|
1722
1727
|
throw new Error(`Cannot unwind blocks from block ${from} when the last block is ${last}`);
|
|
@@ -1726,7 +1731,7 @@ export class ArchiverStoreHelper
|
|
|
1726
1731
|
}
|
|
1727
1732
|
|
|
1728
1733
|
// from - blocksToUnwind = the new head, so + 1 for what we need to remove
|
|
1729
|
-
const blocks = await this.getPublishedBlocks(from - blocksToUnwind + 1, blocksToUnwind);
|
|
1734
|
+
const blocks = await this.getPublishedBlocks(BlockNumber(from - blocksToUnwind + 1), blocksToUnwind);
|
|
1730
1735
|
|
|
1731
1736
|
const opResults = await Promise.all([
|
|
1732
1737
|
// Prune rolls back to the last proven block, which is by definition valid
|
|
@@ -1758,10 +1763,10 @@ export class ArchiverStoreHelper
|
|
|
1758
1763
|
return opResults.every(Boolean);
|
|
1759
1764
|
}
|
|
1760
1765
|
|
|
1761
|
-
getPublishedBlocks(from:
|
|
1766
|
+
getPublishedBlocks(from: BlockNumber, limit: number): Promise<PublishedL2Block[]> {
|
|
1762
1767
|
return this.store.getPublishedBlocks(from, limit);
|
|
1763
1768
|
}
|
|
1764
|
-
getPublishedBlock(number:
|
|
1769
|
+
getPublishedBlock(number: BlockNumber): Promise<PublishedL2Block | undefined> {
|
|
1765
1770
|
return this.store.getPublishedBlock(number);
|
|
1766
1771
|
}
|
|
1767
1772
|
getPublishedBlockByHash(blockHash: Fr): Promise<PublishedL2Block | undefined> {
|
|
@@ -1770,7 +1775,7 @@ export class ArchiverStoreHelper
|
|
|
1770
1775
|
getPublishedBlockByArchive(archive: Fr): Promise<PublishedL2Block | undefined> {
|
|
1771
1776
|
return this.store.getPublishedBlockByArchive(archive);
|
|
1772
1777
|
}
|
|
1773
|
-
getBlockHeaders(from:
|
|
1778
|
+
getBlockHeaders(from: BlockNumber, limit: number): Promise<BlockHeader[]> {
|
|
1774
1779
|
return this.store.getBlockHeaders(from, limit);
|
|
1775
1780
|
}
|
|
1776
1781
|
getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined> {
|
|
@@ -1788,13 +1793,13 @@ export class ArchiverStoreHelper
|
|
|
1788
1793
|
addL1ToL2Messages(messages: InboxMessage[]): Promise<void> {
|
|
1789
1794
|
return this.store.addL1ToL2Messages(messages);
|
|
1790
1795
|
}
|
|
1791
|
-
getL1ToL2Messages(blockNumber:
|
|
1796
|
+
getL1ToL2Messages(blockNumber: BlockNumber): Promise<Fr[]> {
|
|
1792
1797
|
return this.store.getL1ToL2Messages(blockNumber);
|
|
1793
1798
|
}
|
|
1794
1799
|
getL1ToL2MessageIndex(l1ToL2Message: Fr): Promise<bigint | undefined> {
|
|
1795
1800
|
return this.store.getL1ToL2MessageIndex(l1ToL2Message);
|
|
1796
1801
|
}
|
|
1797
|
-
getPrivateLogs(from:
|
|
1802
|
+
getPrivateLogs(from: BlockNumber, limit: number): Promise<PrivateLog[]> {
|
|
1798
1803
|
return this.store.getPrivateLogs(from, limit);
|
|
1799
1804
|
}
|
|
1800
1805
|
getLogsByTags(tags: Fr[], logsPerTag?: number): Promise<TxScopedL2Log[][]> {
|
|
@@ -1806,13 +1811,13 @@ export class ArchiverStoreHelper
|
|
|
1806
1811
|
getContractClassLogs(filter: LogFilter): Promise<GetContractClassLogsResponse> {
|
|
1807
1812
|
return this.store.getContractClassLogs(filter);
|
|
1808
1813
|
}
|
|
1809
|
-
getSynchedL2BlockNumber(): Promise<
|
|
1814
|
+
getSynchedL2BlockNumber(): Promise<BlockNumber> {
|
|
1810
1815
|
return this.store.getSynchedL2BlockNumber();
|
|
1811
1816
|
}
|
|
1812
|
-
getProvenL2BlockNumber(): Promise<
|
|
1817
|
+
getProvenL2BlockNumber(): Promise<BlockNumber> {
|
|
1813
1818
|
return this.store.getProvenL2BlockNumber();
|
|
1814
1819
|
}
|
|
1815
|
-
setProvenL2BlockNumber(l2BlockNumber:
|
|
1820
|
+
setProvenL2BlockNumber(l2BlockNumber: BlockNumber): Promise<void> {
|
|
1816
1821
|
return this.store.setProvenL2BlockNumber(l2BlockNumber);
|
|
1817
1822
|
}
|
|
1818
1823
|
setBlockSynchedL1BlockNumber(l1BlockNumber: bigint): Promise<void> {
|
|
@@ -1848,7 +1853,7 @@ export class ArchiverStoreHelper
|
|
|
1848
1853
|
estimateSize(): Promise<{ mappingSize: number; physicalFileSize: number; actualSize: number; numItems: number }> {
|
|
1849
1854
|
return this.store.estimateSize();
|
|
1850
1855
|
}
|
|
1851
|
-
rollbackL1ToL2MessagesToL2Block(targetBlockNumber:
|
|
1856
|
+
rollbackL1ToL2MessagesToL2Block(targetBlockNumber: BlockNumber): Promise<void> {
|
|
1852
1857
|
return this.store.rollbackL1ToL2MessagesToL2Block(targetBlockNumber);
|
|
1853
1858
|
}
|
|
1854
1859
|
iterateL1ToL2Messages(range: CustomRange<bigint> = {}): AsyncIterableIterator<InboxMessage> {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { L1BlockId } from '@aztec/ethereum';
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import type { Fr } from '@aztec/foundation/fields';
|
|
3
4
|
import type { CustomRange } from '@aztec/kv-store';
|
|
4
5
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
@@ -53,13 +54,13 @@ export interface ArchiverDataStore {
|
|
|
53
54
|
* @param blocksToUnwind - The number of blocks we are to unwind
|
|
54
55
|
* @returns True if the operation is successful
|
|
55
56
|
*/
|
|
56
|
-
unwindBlocks(from:
|
|
57
|
+
unwindBlocks(from: BlockNumber, blocksToUnwind: number): Promise<boolean>;
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
60
|
* Returns the block for the given number, or undefined if not exists.
|
|
60
61
|
* @param number - The block number to return.
|
|
61
62
|
*/
|
|
62
|
-
getPublishedBlock(number:
|
|
63
|
+
getPublishedBlock(number: BlockNumber): Promise<PublishedL2Block | undefined>;
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
66
|
* Returns the block for the given hash, or undefined if not exists.
|
|
@@ -79,7 +80,7 @@ export interface ArchiverDataStore {
|
|
|
79
80
|
* @param limit - The number of blocks to return.
|
|
80
81
|
* @returns The requested L2 blocks.
|
|
81
82
|
*/
|
|
82
|
-
getPublishedBlocks(from:
|
|
83
|
+
getPublishedBlocks(from: BlockNumber, limit: number): Promise<PublishedL2Block[]>;
|
|
83
84
|
|
|
84
85
|
/**
|
|
85
86
|
* Gets up to `limit` amount of L2 block headers starting from `from`.
|
|
@@ -87,7 +88,7 @@ export interface ArchiverDataStore {
|
|
|
87
88
|
* @param limit - The number of blocks to return.
|
|
88
89
|
* @returns The requested L2 block headers.
|
|
89
90
|
*/
|
|
90
|
-
getBlockHeaders(from:
|
|
91
|
+
getBlockHeaders(from: BlockNumber, limit: number): Promise<BlockHeader[]>;
|
|
91
92
|
|
|
92
93
|
/**
|
|
93
94
|
* Returns the block header for the given hash, or undefined if not exists.
|
|
@@ -135,7 +136,7 @@ export interface ArchiverDataStore {
|
|
|
135
136
|
* @param blockNumber - L2 block number to get messages for.
|
|
136
137
|
* @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
|
|
137
138
|
*/
|
|
138
|
-
getL1ToL2Messages(blockNumber:
|
|
139
|
+
getL1ToL2Messages(blockNumber: BlockNumber): Promise<Fr[]>;
|
|
139
140
|
|
|
140
141
|
/**
|
|
141
142
|
* Gets the L1 to L2 message index in the L1 to L2 message tree.
|
|
@@ -156,7 +157,7 @@ export interface ArchiverDataStore {
|
|
|
156
157
|
* @param limit - The maximum number of blocks to retrieve logs from.
|
|
157
158
|
* @returns An array of private logs from the specified range of blocks.
|
|
158
159
|
*/
|
|
159
|
-
getPrivateLogs(from:
|
|
160
|
+
getPrivateLogs(from: BlockNumber, limit: number): Promise<PrivateLog[]>;
|
|
160
161
|
|
|
161
162
|
/**
|
|
162
163
|
* Gets all logs that match any of the received tags (i.e. logs with their first field equal to a tag).
|
|
@@ -185,19 +186,19 @@ export interface ArchiverDataStore {
|
|
|
185
186
|
* Gets the number of the latest L2 block processed.
|
|
186
187
|
* @returns The number of the latest L2 block processed.
|
|
187
188
|
*/
|
|
188
|
-
getSynchedL2BlockNumber(): Promise<
|
|
189
|
+
getSynchedL2BlockNumber(): Promise<BlockNumber>;
|
|
189
190
|
|
|
190
191
|
/**
|
|
191
192
|
* Gets the number of the latest proven L2 block processed.
|
|
192
193
|
* @returns The number of the latest proven L2 block processed.
|
|
193
194
|
*/
|
|
194
|
-
getProvenL2BlockNumber(): Promise<
|
|
195
|
+
getProvenL2BlockNumber(): Promise<BlockNumber>;
|
|
195
196
|
|
|
196
197
|
/**
|
|
197
198
|
* Stores the number of the latest proven L2 block processed.
|
|
198
199
|
* @param l2BlockNumber - The number of the latest proven L2 block processed.
|
|
199
200
|
*/
|
|
200
|
-
setProvenL2BlockNumber(l2BlockNumber:
|
|
201
|
+
setProvenL2BlockNumber(l2BlockNumber: BlockNumber): Promise<void>;
|
|
201
202
|
|
|
202
203
|
/**
|
|
203
204
|
* Stores the l1 block number that blocks have been synched until
|
|
@@ -221,9 +222,13 @@ export interface ArchiverDataStore {
|
|
|
221
222
|
* @param blockNumber - Number of the L2 block the contracts were registered in.
|
|
222
223
|
* @returns True if the operation is successful.
|
|
223
224
|
*/
|
|
224
|
-
addContractClasses(
|
|
225
|
+
addContractClasses(
|
|
226
|
+
data: ContractClassPublic[],
|
|
227
|
+
bytecodeCommitments: Fr[],
|
|
228
|
+
blockNumber: BlockNumber,
|
|
229
|
+
): Promise<boolean>;
|
|
225
230
|
|
|
226
|
-
deleteContractClasses(data: ContractClassPublic[], blockNumber:
|
|
231
|
+
deleteContractClasses(data: ContractClassPublic[], blockNumber: BlockNumber): Promise<boolean>;
|
|
227
232
|
|
|
228
233
|
getBytecodeCommitment(contractClassId: Fr): Promise<Fr | undefined>;
|
|
229
234
|
|
|
@@ -239,8 +244,8 @@ export interface ArchiverDataStore {
|
|
|
239
244
|
* @param blockNumber - Number of the L2 block the instances were deployed in.
|
|
240
245
|
* @returns True if the operation is successful.
|
|
241
246
|
*/
|
|
242
|
-
addContractInstances(data: ContractInstanceWithAddress[], blockNumber:
|
|
243
|
-
deleteContractInstances(data: ContractInstanceWithAddress[], blockNumber:
|
|
247
|
+
addContractInstances(data: ContractInstanceWithAddress[], blockNumber: BlockNumber): Promise<boolean>;
|
|
248
|
+
deleteContractInstances(data: ContractInstanceWithAddress[], blockNumber: BlockNumber): Promise<boolean>;
|
|
244
249
|
|
|
245
250
|
/**
|
|
246
251
|
* Add new contract instance updates
|
|
@@ -286,7 +291,7 @@ export interface ArchiverDataStore {
|
|
|
286
291
|
close(): Promise<void>;
|
|
287
292
|
|
|
288
293
|
/** Deletes all L1 to L2 messages up until (excluding) the target L2 block number. */
|
|
289
|
-
rollbackL1ToL2MessagesToL2Block(targetBlockNumber:
|
|
294
|
+
rollbackL1ToL2MessagesToL2Block(targetBlockNumber: BlockNumber): Promise<void>;
|
|
290
295
|
|
|
291
296
|
/** Returns an async iterator to all L1 to L2 messages on the range. */
|
|
292
297
|
iterateL1ToL2Messages(range?: CustomRange<bigint>): AsyncIterableIterator<InboxMessage>;
|