@aztec/archiver 3.0.0-nightly.20250910 → 3.0.0-nightly.20250912
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 +25 -4
- package/dest/archiver/archiver.d.ts +8 -4
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +50 -25
- package/dest/archiver/archiver_store.d.ts +5 -1
- package/dest/archiver/archiver_store.d.ts.map +1 -1
- package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -1
- package/dest/archiver/archiver_store_test_suite.js +103 -5
- package/dest/archiver/config.d.ts +4 -18
- package/dest/archiver/config.d.ts.map +1 -1
- package/dest/archiver/config.js +5 -1
- package/dest/archiver/data_retrieval.d.ts +2 -2
- package/dest/archiver/data_retrieval.d.ts.map +1 -1
- package/dest/archiver/data_retrieval.js +3 -3
- package/dest/archiver/kv_archiver_store/block_store.d.ts +11 -1
- package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/block_store.js +27 -3
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +3 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.js +6 -0
- package/dest/archiver/validation.d.ts.map +1 -1
- package/dest/archiver/validation.js +7 -4
- package/dest/test/mock_l2_block_source.d.ts +2 -10
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +2 -2
- package/package.json +13 -13
- package/src/archiver/archiver.ts +54 -27
- package/src/archiver/archiver_store.ts +7 -1
- package/src/archiver/archiver_store_test_suite.ts +120 -18
- package/src/archiver/config.ts +13 -28
- package/src/archiver/data_retrieval.ts +3 -7
- package/src/archiver/kv_archiver_store/block_store.ts +44 -4
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +9 -1
- package/src/archiver/validation.ts +22 -2
- package/src/test/mock_l2_block_source.ts +19 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data_retrieval.d.ts","sourceRoot":"","sources":["../../src/archiver/data_retrieval.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EAEV,UAAU,EAGV,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,KAAK,QAAQ,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAW,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"data_retrieval.d.ts","sourceRoot":"","sources":["../../src/archiver/data_retrieval.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EAEV,UAAU,EAGV,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,KAAK,QAAQ,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAW,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EAAgC,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAErG,OAAO,EAEL,KAAK,q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4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
6
|
import { RollupAbi } from '@aztec/l1-artifacts';
|
|
7
|
-
import { Body, CommitteeAttestation, L2Block } from '@aztec/stdlib/block';
|
|
7
|
+
import { Body, CommitteeAttestation, L2Block, PublishedL2Block } from '@aztec/stdlib/block';
|
|
8
8
|
import { Proof } from '@aztec/stdlib/proofs';
|
|
9
9
|
import { AppendOnlyTreeSnapshot } from '@aztec/stdlib/trees';
|
|
10
10
|
import { BlockHeader, GlobalVariables, ProposedBlockHeader, StateReference } from '@aztec/stdlib/tx';
|
|
@@ -32,11 +32,11 @@ export function retrievedBlockToPublishedL2Block(retrievedBlock) {
|
|
|
32
32
|
totalManaUsed: proposedHeader.totalManaUsed
|
|
33
33
|
});
|
|
34
34
|
const block = new L2Block(archive, header, body);
|
|
35
|
-
return {
|
|
35
|
+
return PublishedL2Block.fromFields({
|
|
36
36
|
block,
|
|
37
37
|
l1,
|
|
38
38
|
attestations
|
|
39
|
-
};
|
|
39
|
+
});
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Fetches new L2 blocks.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import { PublishedL2Block, type ValidateBlockResult } from '@aztec/stdlib/block';
|
|
3
4
|
import { BlockHeader, type IndexedTxEffect, TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
4
|
-
import type { PublishedL2Block } from '../structs/published.js';
|
|
5
5
|
export { TxReceipt, type TxEffect, type TxHash } from '@aztec/stdlib/tx';
|
|
6
6
|
/**
|
|
7
7
|
* LMDB implementation of the ArchiverDataStore interface.
|
|
@@ -85,5 +85,15 @@ export declare class BlockStore {
|
|
|
85
85
|
setSynchedL1BlockNumber(l1BlockNumber: bigint): Promise<boolean>;
|
|
86
86
|
getProvenL2BlockNumber(): Promise<number>;
|
|
87
87
|
setProvenL2BlockNumber(blockNumber: number): Promise<boolean>;
|
|
88
|
+
/**
|
|
89
|
+
* Gets the pending chain validation status.
|
|
90
|
+
* @returns The validation status or undefined if not set.
|
|
91
|
+
*/
|
|
92
|
+
getPendingChainValidationStatus(): Promise<ValidateBlockResult | undefined>;
|
|
93
|
+
/**
|
|
94
|
+
* Sets the pending chain validation status.
|
|
95
|
+
* @param status - The validation status to store.
|
|
96
|
+
*/
|
|
97
|
+
setPendingChainValidationStatus(status: ValidateBlockResult | undefined): Promise<void>;
|
|
88
98
|
}
|
|
89
99
|
//# sourceMappingURL=block_store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/kv_archiver_store/block_store.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAA6C,MAAM,iBAAiB,CAAC;AACpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"block_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/kv_archiver_store/block_store.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAA6C,MAAM,iBAAiB,CAAC;AACpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAKL,gBAAgB,EAChB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,WAAW,EACX,KAAK,eAAe,EAEpB,MAAM,EACN,SAAS,EAGV,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAYzE;;GAEG;AACH,qBAAa,UAAU;;IAwBT,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,iBAAiB;IAUzC;;;;OAIG;IACG,SAAS,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MAAM,CAAC;IAQ/C,sBAAsB,CAAC,WAAW,EAAE,MAAM;IAgB1C;;;OAGG;IACG,+BAA+B,IAAI,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAQjF;;;OAGG;IACG,+BAA+B,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAQ9F"}
|
|
@@ -4,7 +4,8 @@ import { toArray } from '@aztec/foundation/iterable';
|
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
6
6
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
7
|
-
import { Body, CommitteeAttestation, L2Block, L2BlockHash } from '@aztec/stdlib/block';
|
|
7
|
+
import { Body, CommitteeAttestation, L2Block, L2BlockHash, PublishedL2Block } from '@aztec/stdlib/block';
|
|
8
|
+
import { deserializeValidateBlockResult, serializeValidateBlockResult } from '@aztec/stdlib/block';
|
|
8
9
|
import { AppendOnlyTreeSnapshot } from '@aztec/stdlib/trees';
|
|
9
10
|
import { BlockHeader, TxHash, TxReceipt, deserializeIndexedTxEffect, serializeIndexedTxEffect } from '@aztec/stdlib/tx';
|
|
10
11
|
import { BlockNumberNotSequentialError, InitialBlockNumberNotSequentialError } from '../errors.js';
|
|
@@ -18,6 +19,7 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
18
19
|
/** Tx hash to serialized IndexedTxEffect */ #txEffects;
|
|
19
20
|
/** Stores L1 block number in which the last processed L2 block was included */ #lastSynchedL1Block;
|
|
20
21
|
/** Stores l2 block number of the last proven block */ #lastProvenL2Block;
|
|
22
|
+
/** Stores the pending chain validation status */ #pendingChainValidationStatus;
|
|
21
23
|
/** Index mapping a contract's address (as a string) to its location in a block */ #contractIndex;
|
|
22
24
|
#log;
|
|
23
25
|
constructor(db){
|
|
@@ -29,6 +31,7 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
29
31
|
this.#contractIndex = db.openMap('archiver_contract_index');
|
|
30
32
|
this.#lastSynchedL1Block = db.openSingleton('archiver_last_synched_l1_block');
|
|
31
33
|
this.#lastProvenL2Block = db.openSingleton('archiver_last_proven_l2_block');
|
|
34
|
+
this.#pendingChainValidationStatus = db.openSingleton('archiver_pending_chain_validation_status');
|
|
32
35
|
}
|
|
33
36
|
/**
|
|
34
37
|
* Append new blocks to the store's list.
|
|
@@ -190,11 +193,11 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
190
193
|
throw new Error(`Block number mismatch when retrieving block from archive (expected ${blockNumber} but got ${block.number} with hash ${blockHashString})`);
|
|
191
194
|
}
|
|
192
195
|
const attestations = blockStorage.attestations.map(CommitteeAttestation.fromBuffer);
|
|
193
|
-
return {
|
|
196
|
+
return PublishedL2Block.fromFields({
|
|
194
197
|
block,
|
|
195
198
|
l1: blockStorage.l1,
|
|
196
199
|
attestations
|
|
197
|
-
};
|
|
200
|
+
});
|
|
198
201
|
}
|
|
199
202
|
/**
|
|
200
203
|
* Gets a tx effect.
|
|
@@ -281,4 +284,25 @@ export { TxReceipt } from '@aztec/stdlib/tx';
|
|
|
281
284
|
limit
|
|
282
285
|
};
|
|
283
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Gets the pending chain validation status.
|
|
289
|
+
* @returns The validation status or undefined if not set.
|
|
290
|
+
*/ async getPendingChainValidationStatus() {
|
|
291
|
+
const buffer = await this.#pendingChainValidationStatus.getAsync();
|
|
292
|
+
if (!buffer) {
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
return deserializeValidateBlockResult(buffer);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Sets the pending chain validation status.
|
|
299
|
+
* @param status - The validation status to store.
|
|
300
|
+
*/ async setPendingChainValidationStatus(status) {
|
|
301
|
+
if (status) {
|
|
302
|
+
const buffer = serializeValidateBlockResult(status);
|
|
303
|
+
await this.#pendingChainValidationStatus.set(buffer);
|
|
304
|
+
} else {
|
|
305
|
+
await this.#pendingChainValidationStatus.delete();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
284
308
|
}
|
|
@@ -3,7 +3,7 @@ import type { Fr } from '@aztec/foundation/fields';
|
|
|
3
3
|
import type { AztecAsyncKVStore, CustomRange, StoreSize } from '@aztec/kv-store';
|
|
4
4
|
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import type { L2Block } from '@aztec/stdlib/block';
|
|
6
|
+
import type { L2Block, ValidateBlockResult } from '@aztec/stdlib/block';
|
|
7
7
|
import type { ContractClassPublic, ContractDataSource, ContractInstanceUpdateWithAddress, ContractInstanceWithAddress, ExecutablePrivateFunctionWithMembershipProof, UtilityFunctionWithMembershipProof } from '@aztec/stdlib/contract';
|
|
8
8
|
import type { GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
|
|
9
9
|
import { type LogFilter, PrivateLog, type TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
@@ -158,5 +158,7 @@ export declare class KVArchiverDataStore implements ArchiverDataStore, ContractD
|
|
|
158
158
|
rollbackL1ToL2MessagesToL2Block(targetBlockNumber: number): Promise<void>;
|
|
159
159
|
iterateL1ToL2Messages(range?: CustomRange<bigint>): AsyncIterableIterator<InboxMessage>;
|
|
160
160
|
removeL1ToL2Messages(startIndex: bigint): Promise<void>;
|
|
161
|
+
getPendingChainValidationStatus(): Promise<ValidateBlockResult | undefined>;
|
|
162
|
+
setPendingChainValidationStatus(status: ValidateBlockResult | undefined): Promise<void>;
|
|
161
163
|
}
|
|
162
164
|
//# sourceMappingURL=kv_archiver_store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kv_archiver_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/kv_archiver_store/kv_archiver_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB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U,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC;IAQ1E;;;;OAIG;IACH,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAQhE;;;;OAIG;IACH,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAQ9E;;;OAGG;IACH,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC;IAI1C,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,sBAAsB,CAAC,WAAW,EAAE,MAAM;IAI1C,4BAA4B,CAAC,aAAa,EAAE,MAAM;IAIlD,wBAAwB,CAAC,OAAO,EAAE,SAAS;IAIjD;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAW7C,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC;IAIlC,+BAA+B,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzE,qBAAqB,CAAC,KAAK,GAAE,WAAW,CAAC,MAAM,CAAM,GAAG,qBAAqB,CAAC,YAAY,CAAC;IAI3F,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD,+BAA+B,IAAI,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAI3E,+BAA+B,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/F"}
|
|
@@ -274,4 +274,10 @@ export const MAX_FUNCTION_NAME_LEN = 256;
|
|
|
274
274
|
removeL1ToL2Messages(startIndex) {
|
|
275
275
|
return this.#messageStore.removeL1ToL2Messages(startIndex);
|
|
276
276
|
}
|
|
277
|
+
getPendingChainValidationStatus() {
|
|
278
|
+
return this.#blockStore.getPendingChainValidationStatus();
|
|
279
|
+
}
|
|
280
|
+
setPendingChainValidationStatus(status) {
|
|
281
|
+
return this.#blockStore.setPendingChainValidationStatus(status);
|
|
282
|
+
}
|
|
277
283
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/archiver/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EAEzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,iBAAiB,EAAkB,MAAM,6BAA6B,CAAC;AAErF,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,cAAc,EAAE,gBAAgB,EAChC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,EACnD,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/archiver/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EAEzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,iBAAiB,EAAkB,MAAM,6BAA6B,CAAC;AAErF,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,cAAc,EAAE,gBAAgB,EAChC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,EACnD,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,mBAAmB,CAAC,CAqE9B"}
|
|
@@ -5,6 +5,7 @@ import { getEpochAtSlot } from '@aztec/stdlib/epoch-helpers';
|
|
|
5
5
|
* Returns true if the attestations are valid and sufficient, false otherwise.
|
|
6
6
|
*/ export async function validateBlockAttestations(publishedBlock, epochCache, constants, logger) {
|
|
7
7
|
const attestations = getAttestationsFromPublishedL2Block(publishedBlock);
|
|
8
|
+
const attestors = attestations.map((a)=>a.getSender());
|
|
8
9
|
const { block } = publishedBlock;
|
|
9
10
|
const blockHash = await block.hash().then((hash)=>hash.toString());
|
|
10
11
|
const archiveRoot = block.archive.root.toString();
|
|
@@ -44,11 +45,12 @@ import { getEpochAtSlot } from '@aztec/stdlib/epoch-helpers';
|
|
|
44
45
|
valid: false,
|
|
45
46
|
reason,
|
|
46
47
|
invalidIndex: i,
|
|
47
|
-
block: publishedBlock,
|
|
48
|
+
block: publishedBlock.block.toBlockInfo(),
|
|
48
49
|
committee,
|
|
49
50
|
seed,
|
|
50
51
|
epoch,
|
|
51
|
-
|
|
52
|
+
attestors,
|
|
53
|
+
attestations: publishedBlock.attestations
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
56
|
}
|
|
@@ -62,11 +64,12 @@ import { getEpochAtSlot } from '@aztec/stdlib/epoch-helpers';
|
|
|
62
64
|
return {
|
|
63
65
|
valid: false,
|
|
64
66
|
reason,
|
|
65
|
-
block: publishedBlock,
|
|
67
|
+
block: publishedBlock.block.toBlockInfo(),
|
|
66
68
|
committee,
|
|
67
69
|
seed,
|
|
68
70
|
epoch,
|
|
69
|
-
|
|
71
|
+
attestors,
|
|
72
|
+
attestations: publishedBlock.attestations
|
|
70
73
|
};
|
|
71
74
|
}
|
|
72
75
|
logger?.debug(`Block attestations validated successfully for block ${block.number} at slot ${slot}`, logData);
|
|
@@ -2,7 +2,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
2
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import { L2Block, L2BlockHash, type L2BlockSource, type L2Tips, type ValidateBlockResult } from '@aztec/stdlib/block';
|
|
5
|
+
import { L2Block, L2BlockHash, type L2BlockSource, type L2Tips, PublishedL2Block, type ValidateBlockResult } from '@aztec/stdlib/block';
|
|
6
6
|
import type { ContractClassPublic, ContractDataSource, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
7
7
|
import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
8
8
|
import { type BlockHeader, TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
@@ -49,15 +49,7 @@ export declare class MockL2BlockSource implements L2BlockSource, ContractDataSou
|
|
|
49
49
|
* @returns The requested mocked L2 blocks.
|
|
50
50
|
*/
|
|
51
51
|
getBlocks(from: number, limit: number, proven?: boolean): Promise<L2Block[]>;
|
|
52
|
-
getPublishedBlocks(from: number, limit: number, proven?: boolean): Promise<
|
|
53
|
-
block: L2Block;
|
|
54
|
-
l1: {
|
|
55
|
-
blockNumber: bigint;
|
|
56
|
-
blockHash: `0x${string}`;
|
|
57
|
-
timestamp: bigint;
|
|
58
|
-
};
|
|
59
|
-
attestations: never[];
|
|
60
|
-
}[]>;
|
|
52
|
+
getPublishedBlocks(from: number, limit: number, proven?: boolean): Promise<PublishedL2Block[]>;
|
|
61
53
|
getBlockHeader(number: number | 'latest'): Promise<BlockHeader | undefined>;
|
|
62
54
|
getBlocksForEpoch(epochNumber: bigint): Promise<L2Block[]>;
|
|
63
55
|
getBlockHeadersForEpoch(epochNumber: bigint): Promise<BlockHeader[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock_l2_block_source.d.ts","sourceRoot":"","sources":["../../src/test/mock_l2_block_source.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,EAAE,EAAE,MAA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,CAAC,IAAI,CAAC;IAK7B;;;OAGG;IACI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,gBAAgB,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAInE,qBAAqB,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IAIvD,WAAW,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC;IAI1G,mBAAmB,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;IAIpC,oBAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAItG,kCAAkC,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxE,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC;IAIzC,+BAA+B,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAGhE"}
|
|
@@ -2,7 +2,7 @@ import { DefaultL1ContractsConfig } from '@aztec/ethereum';
|
|
|
2
2
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import { L2Block, L2BlockHash } from '@aztec/stdlib/block';
|
|
5
|
+
import { L2Block, L2BlockHash, PublishedL2Block } from '@aztec/stdlib/block';
|
|
6
6
|
import { EmptyL1RollupConstants, getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
|
|
7
7
|
import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
8
8
|
/**
|
|
@@ -75,7 +75,7 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
75
75
|
}
|
|
76
76
|
async getPublishedBlocks(from, limit, proven) {
|
|
77
77
|
const blocks = await this.getBlocks(from, limit, proven);
|
|
78
|
-
return blocks.map((block)=>({
|
|
78
|
+
return blocks.map((block)=>PublishedL2Block.fromFields({
|
|
79
79
|
block,
|
|
80
80
|
l1: {
|
|
81
81
|
blockNumber: BigInt(block.number),
|
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.20250912",
|
|
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.20250912",
|
|
70
|
+
"@aztec/blob-sink": "3.0.0-nightly.20250912",
|
|
71
|
+
"@aztec/constants": "3.0.0-nightly.20250912",
|
|
72
|
+
"@aztec/epoch-cache": "3.0.0-nightly.20250912",
|
|
73
|
+
"@aztec/ethereum": "3.0.0-nightly.20250912",
|
|
74
|
+
"@aztec/foundation": "3.0.0-nightly.20250912",
|
|
75
|
+
"@aztec/kv-store": "3.0.0-nightly.20250912",
|
|
76
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20250912",
|
|
77
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20250912",
|
|
78
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20250912",
|
|
79
|
+
"@aztec/stdlib": "3.0.0-nightly.20250912",
|
|
80
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20250912",
|
|
81
81
|
"lodash.groupby": "^4.6.0",
|
|
82
82
|
"lodash.omit": "^4.5.0",
|
|
83
83
|
"tsc-watch": "^6.0.0",
|
package/src/archiver/archiver.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@aztec/ethereum';
|
|
11
11
|
import { maxBigint } from '@aztec/foundation/bigint';
|
|
12
12
|
import { Buffer16, Buffer32 } from '@aztec/foundation/buffer';
|
|
13
|
-
import { pick } from '@aztec/foundation/collection';
|
|
13
|
+
import { merge, pick } from '@aztec/foundation/collection';
|
|
14
14
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
15
15
|
import { Fr } from '@aztec/foundation/fields';
|
|
16
16
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
@@ -102,6 +102,14 @@ export type ArchiverDeps = {
|
|
|
102
102
|
dateProvider?: DateProvider;
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
+
function mapArchiverConfig(config: Partial<ArchiverConfig>) {
|
|
106
|
+
return {
|
|
107
|
+
pollingIntervalMs: config.archiverPollingIntervalMS,
|
|
108
|
+
batchSize: config.archiverBatchSize,
|
|
109
|
+
skipValidateBlockAttestations: config.skipValidateBlockAttestations,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
105
113
|
/**
|
|
106
114
|
* Pulls L2 blocks in a non-blocking manner and provides interface for their retrieval.
|
|
107
115
|
* Responsible for handling robust L1 polling so that other components do not need to
|
|
@@ -120,7 +128,6 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
120
128
|
|
|
121
129
|
private l1BlockNumber: bigint | undefined;
|
|
122
130
|
private l1Timestamp: bigint | undefined;
|
|
123
|
-
private pendingChainValidationStatus: ValidateBlockResult = { valid: true };
|
|
124
131
|
private initialSyncComplete: boolean = false;
|
|
125
132
|
|
|
126
133
|
public readonly tracer: Tracer;
|
|
@@ -139,7 +146,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
139
146
|
private readonly publicClient: ViemPublicClient,
|
|
140
147
|
private readonly l1Addresses: { rollupAddress: EthAddress; inboxAddress: EthAddress; registryAddress: EthAddress },
|
|
141
148
|
readonly dataStore: ArchiverDataStore,
|
|
142
|
-
private
|
|
149
|
+
private config: { pollingIntervalMs: number; batchSize: number; skipValidateBlockAttestations?: boolean },
|
|
143
150
|
private readonly blobSinkClient: BlobSinkClientInterface,
|
|
144
151
|
private readonly epochCache: EpochCache,
|
|
145
152
|
private readonly instrumentation: ArchiverInstrumentation,
|
|
@@ -199,10 +206,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
199
206
|
proofSubmissionEpochs: Number(proofSubmissionEpochs),
|
|
200
207
|
};
|
|
201
208
|
|
|
202
|
-
const opts = {
|
|
203
|
-
pollingIntervalMs: config.archiverPollingIntervalMS ?? 10_000,
|
|
204
|
-
batchSize: config.archiverBatchSize ?? 100,
|
|
205
|
-
};
|
|
209
|
+
const opts = merge({ pollingIntervalMs: 10_000, batchSize: 100 }, mapArchiverConfig(config));
|
|
206
210
|
|
|
207
211
|
const epochCache = deps.epochCache ?? (await EpochCache.create(config.l1Contracts.rollupAddress, config, deps));
|
|
208
212
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
@@ -221,6 +225,11 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
221
225
|
return archiver;
|
|
222
226
|
}
|
|
223
227
|
|
|
228
|
+
/** Updates archiver config */
|
|
229
|
+
public updateConfig(newConfig: Partial<ArchiverConfig>) {
|
|
230
|
+
this.config = merge(this.config, mapArchiverConfig(newConfig));
|
|
231
|
+
}
|
|
232
|
+
|
|
224
233
|
/**
|
|
225
234
|
* Starts sync process.
|
|
226
235
|
* @param blockUntilSynced - If true, blocks until the archiver has fully synced.
|
|
@@ -342,7 +351,8 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
342
351
|
|
|
343
352
|
// ********** Events that are processed per L2 block **********
|
|
344
353
|
if (currentL1BlockNumber > blocksSynchedTo) {
|
|
345
|
-
// First we retrieve new L2 blocks
|
|
354
|
+
// First we retrieve new L2 blocks and store them in the DB. This will also update the
|
|
355
|
+
// pending chain validation status, proven block number, and synched L1 block number.
|
|
346
356
|
const rollupStatus = await this.handleL2blocks(blocksSynchedTo, currentL1BlockNumber);
|
|
347
357
|
// Then we prune the current epoch if it'd reorg on next submission.
|
|
348
358
|
// Note that we don't do this before retrieving L2 blocks because we may need to retrieve
|
|
@@ -355,21 +365,11 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
355
365
|
currentL1Timestamp,
|
|
356
366
|
);
|
|
357
367
|
|
|
358
|
-
// Update the pending chain validation status with the last block validation result.
|
|
359
|
-
// Again, we only update if validation status changed, so in a sequence of invalid blocks
|
|
360
|
-
// we keep track of the first invalid block so we can invalidate that one if needed.
|
|
361
|
-
if (
|
|
362
|
-
rollupStatus.validationResult &&
|
|
363
|
-
rollupStatus.validationResult?.valid !== this.pendingChainValidationStatus.valid
|
|
364
|
-
) {
|
|
365
|
-
this.pendingChainValidationStatus = rollupStatus.validationResult;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
368
|
// And lastly we check if we are missing any L2 blocks behind us due to a possible L1 reorg.
|
|
369
369
|
// We only do this if rollup cant prune on the next submission. Otherwise we will end up
|
|
370
370
|
// re-syncing the blocks we have just unwound above. We also dont do this if the last block is invalid,
|
|
371
371
|
// since the archiver will rightfully refuse to sync up to it.
|
|
372
|
-
if (!rollupCanPrune &&
|
|
372
|
+
if (!rollupCanPrune && rollupStatus.validationResult?.valid) {
|
|
373
373
|
await this.checkForNewBlocksBeforeL1SyncPoint(rollupStatus, blocksSynchedTo, currentL1BlockNumber);
|
|
374
374
|
}
|
|
375
375
|
|
|
@@ -623,6 +623,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
623
623
|
|
|
624
624
|
private async handleL2blocks(blocksSynchedTo: bigint, currentL1BlockNumber: bigint) {
|
|
625
625
|
const localPendingBlockNumber = await this.getBlockNumber();
|
|
626
|
+
const initialValidationResult: ValidateBlockResult | undefined = await this.store.getPendingChainValidationStatus();
|
|
626
627
|
const [provenBlockNumber, provenArchive, pendingBlockNumber, pendingArchive, archiveForLocalPendingBlockNumber] =
|
|
627
628
|
await this.rollup.status(BigInt(localPendingBlockNumber), { blockNumber: currentL1BlockNumber });
|
|
628
629
|
const rollupStatus = {
|
|
@@ -630,7 +631,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
630
631
|
provenArchive,
|
|
631
632
|
pendingBlockNumber: Number(pendingBlockNumber),
|
|
632
633
|
pendingArchive,
|
|
633
|
-
validationResult:
|
|
634
|
+
validationResult: initialValidationResult,
|
|
634
635
|
};
|
|
635
636
|
this.log.trace(`Retrieved rollup status at current L1 block ${currentL1BlockNumber}.`, {
|
|
636
637
|
localPendingBlockNumber,
|
|
@@ -805,11 +806,21 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
805
806
|
const validBlocks: PublishedL2Block[] = [];
|
|
806
807
|
|
|
807
808
|
for (const block of publishedBlocks) {
|
|
808
|
-
const validationResult =
|
|
809
|
+
const validationResult = this.config.skipValidateBlockAttestations
|
|
810
|
+
? { valid: true as const }
|
|
811
|
+
: await validateBlockAttestations(block, this.epochCache, this.l1constants, this.log);
|
|
809
812
|
|
|
810
813
|
// Only update the validation result if it has changed, so we can keep track of the first invalid block
|
|
811
814
|
// in case there is a sequence of more than one invalid block, as we need to invalidate the first one.
|
|
812
|
-
if
|
|
815
|
+
// There is an exception though: if an invalid block is invalidated and replaced with another invalid block,
|
|
816
|
+
// we need to update the validation result, since we need to be able to invalidate the new one.
|
|
817
|
+
// See test 'chain progresses if an invalid block is invalidated with an invalid one' for more info.
|
|
818
|
+
if (
|
|
819
|
+
rollupStatus.validationResult?.valid !== validationResult.valid ||
|
|
820
|
+
(!rollupStatus.validationResult.valid &&
|
|
821
|
+
!validationResult.valid &&
|
|
822
|
+
rollupStatus.validationResult.block.blockNumber === validationResult.block.blockNumber)
|
|
823
|
+
) {
|
|
813
824
|
rollupStatus.validationResult = validationResult;
|
|
814
825
|
}
|
|
815
826
|
|
|
@@ -828,6 +839,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
828
839
|
|
|
829
840
|
// We keep consuming blocks if we find an invalid one, since we do not listen for BlockInvalidated events
|
|
830
841
|
// We just pretend the invalid ones are not there and keep consuming the next blocks
|
|
842
|
+
// Note that this breaks if the committee ever attests to a descendant of an invalid block
|
|
831
843
|
continue;
|
|
832
844
|
}
|
|
833
845
|
|
|
@@ -841,7 +853,9 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
841
853
|
}
|
|
842
854
|
|
|
843
855
|
try {
|
|
844
|
-
const
|
|
856
|
+
const updatedValidationResult =
|
|
857
|
+
rollupStatus.validationResult === initialValidationResult ? undefined : rollupStatus.validationResult;
|
|
858
|
+
const [processDuration] = await elapsed(() => this.store.addBlocks(validBlocks, updatedValidationResult));
|
|
845
859
|
this.instrumentation.processNewBlocks(
|
|
846
860
|
processDuration / validBlocks.length,
|
|
847
861
|
validBlocks.map(b => b.block),
|
|
@@ -1228,12 +1242,12 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
|
|
|
1228
1242
|
return this.store.getDebugFunctionName(address, selector);
|
|
1229
1243
|
}
|
|
1230
1244
|
|
|
1231
|
-
getPendingChainValidationStatus(): Promise<ValidateBlockResult> {
|
|
1232
|
-
return
|
|
1245
|
+
async getPendingChainValidationStatus(): Promise<ValidateBlockResult> {
|
|
1246
|
+
return (await this.store.getPendingChainValidationStatus()) ?? { valid: true };
|
|
1233
1247
|
}
|
|
1234
1248
|
|
|
1235
1249
|
isPendingChainInvalid(): Promise<boolean> {
|
|
1236
|
-
return
|
|
1250
|
+
return this.getPendingChainValidationStatus().then(status => !status.valid);
|
|
1237
1251
|
}
|
|
1238
1252
|
|
|
1239
1253
|
async getL2Tips(): Promise<L2Tips> {
|
|
@@ -1351,6 +1365,7 @@ export class ArchiverStoreHelper
|
|
|
1351
1365
|
| 'backupTo'
|
|
1352
1366
|
| 'close'
|
|
1353
1367
|
| 'transactionAsync'
|
|
1368
|
+
| 'addBlocks'
|
|
1354
1369
|
>
|
|
1355
1370
|
{
|
|
1356
1371
|
#log = createLogger('archiver:block-helper');
|
|
@@ -1493,13 +1508,16 @@ export class ArchiverStoreHelper
|
|
|
1493
1508
|
return true;
|
|
1494
1509
|
}
|
|
1495
1510
|
|
|
1496
|
-
public addBlocks(blocks: PublishedL2Block[]): Promise<boolean> {
|
|
1511
|
+
public addBlocks(blocks: PublishedL2Block[], pendingChainValidationStatus?: ValidateBlockResult): Promise<boolean> {
|
|
1497
1512
|
// Add the blocks to the store. Store will throw if the blocks are not in order, there are gaps,
|
|
1498
1513
|
// or if the previous block is not in the store.
|
|
1499
1514
|
return this.store.transactionAsync(async () => {
|
|
1500
1515
|
await this.store.addBlocks(blocks);
|
|
1501
1516
|
|
|
1502
1517
|
const opResults = await Promise.all([
|
|
1518
|
+
// Update the pending chain validation status if provided
|
|
1519
|
+
pendingChainValidationStatus && this.store.setPendingChainValidationStatus(pendingChainValidationStatus),
|
|
1520
|
+
// Add any logs emitted during the retrieved blocks
|
|
1503
1521
|
this.store.addLogs(blocks.map(block => block.block)),
|
|
1504
1522
|
// Unroll all logs emitted during the retrieved blocks and extract any contract classes and instances from them
|
|
1505
1523
|
...blocks.map(async block => {
|
|
@@ -1539,6 +1557,8 @@ export class ArchiverStoreHelper
|
|
|
1539
1557
|
const blocks = await this.getPublishedBlocks(from - blocksToUnwind + 1, blocksToUnwind);
|
|
1540
1558
|
|
|
1541
1559
|
const opResults = await Promise.all([
|
|
1560
|
+
// Prune rolls back to the last proven block, which is by definition valid
|
|
1561
|
+
this.store.setPendingChainValidationStatus({ valid: true }),
|
|
1542
1562
|
// Unroll all logs emitted during the retrieved blocks and extract any contract classes and instances from them
|
|
1543
1563
|
...blocks.map(async block => {
|
|
1544
1564
|
const contractClassLogs = block.block.body.txEffects.flatMap(txEffect => txEffect.contractClassLogs);
|
|
@@ -1656,4 +1676,11 @@ export class ArchiverStoreHelper
|
|
|
1656
1676
|
getLastL1ToL2Message(): Promise<InboxMessage | undefined> {
|
|
1657
1677
|
return this.store.getLastL1ToL2Message();
|
|
1658
1678
|
}
|
|
1679
|
+
getPendingChainValidationStatus(): Promise<ValidateBlockResult | undefined> {
|
|
1680
|
+
return this.store.getPendingChainValidationStatus();
|
|
1681
|
+
}
|
|
1682
|
+
setPendingChainValidationStatus(status: ValidateBlockResult | undefined): Promise<void> {
|
|
1683
|
+
this.#log.debug(`Setting pending chain validation status to valid ${status?.valid}`, status);
|
|
1684
|
+
return this.store.setPendingChainValidationStatus(status);
|
|
1685
|
+
}
|
|
1659
1686
|
}
|
|
@@ -3,7 +3,7 @@ import type { Fr } from '@aztec/foundation/fields';
|
|
|
3
3
|
import type { CustomRange } from '@aztec/kv-store';
|
|
4
4
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import type { L2Block } from '@aztec/stdlib/block';
|
|
6
|
+
import type { L2Block, ValidateBlockResult } from '@aztec/stdlib/block';
|
|
7
7
|
import type {
|
|
8
8
|
ContractClassPublic,
|
|
9
9
|
ContractInstanceUpdateWithAddress,
|
|
@@ -272,4 +272,10 @@ export interface ArchiverDataStore {
|
|
|
272
272
|
|
|
273
273
|
/** Returns the last L1 to L2 message stored. */
|
|
274
274
|
getLastL1ToL2Message(): Promise<InboxMessage | undefined>;
|
|
275
|
+
|
|
276
|
+
/** Returns the last synced validation status of the pending chain. */
|
|
277
|
+
getPendingChainValidationStatus(): Promise<ValidateBlockResult | undefined>;
|
|
278
|
+
|
|
279
|
+
/** Sets the last synced validation status of the pending chain. */
|
|
280
|
+
setPendingChainValidationStatus(status: ValidateBlockResult | undefined): Promise<void>;
|
|
275
281
|
}
|