@aztec/archiver 0.80.0 → 0.82.0
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 +8 -20
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +72 -102
- package/dest/archiver/archiver_store.d.ts +5 -19
- 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 +105 -142
- package/dest/archiver/config.d.ts +2 -0
- package/dest/archiver/config.d.ts.map +1 -1
- package/dest/archiver/config.js +5 -0
- package/dest/archiver/data_retrieval.d.ts +3 -4
- package/dest/archiver/data_retrieval.d.ts.map +1 -1
- package/dest/archiver/data_retrieval.js +8 -3
- package/dest/archiver/index.d.ts +1 -2
- package/dest/archiver/index.d.ts.map +1 -1
- package/dest/archiver/index.js +0 -1
- package/dest/archiver/kv_archiver_store/block_store.d.ts +6 -6
- package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/block_store.js +24 -21
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +6 -14
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.js +2 -19
- package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/log_store.js +11 -42
- package/dest/archiver/structs/published.d.ts +1 -10
- package/dest/archiver/structs/published.d.ts.map +1 -1
- package/dest/archiver/structs/published.js +1 -1
- package/dest/factory.d.ts +1 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +6 -24
- package/dest/test/mock_l2_block_source.d.ts +10 -0
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +16 -0
- package/package.json +12 -13
- package/src/archiver/archiver.ts +86 -124
- package/src/archiver/archiver_store.ts +5 -21
- package/src/archiver/archiver_store_test_suite.ts +116 -147
- package/src/archiver/config.ts +8 -0
- package/src/archiver/data_retrieval.ts +12 -11
- package/src/archiver/index.ts +1 -2
- package/src/archiver/kv_archiver_store/block_store.ts +28 -27
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +6 -27
- package/src/archiver/kv_archiver_store/log_store.ts +12 -59
- package/src/archiver/structs/published.ts +1 -11
- package/src/factory.ts +3 -28
- package/src/test/mock_l2_block_source.ts +18 -0
- package/dest/archiver/kv_archiver_store/nullifier_store.d.ts +0 -12
- package/dest/archiver/kv_archiver_store/nullifier_store.d.ts.map +0 -1
- package/dest/archiver/kv_archiver_store/nullifier_store.js +0 -73
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts +0 -175
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts.map +0 -1
- package/dest/archiver/memory_archiver_store/memory_archiver_store.js +0 -636
- package/src/archiver/kv_archiver_store/nullifier_store.ts +0 -97
- package/src/archiver/memory_archiver_store/memory_archiver_store.ts +0 -801
|
@@ -6,8 +6,8 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
6
6
|
import { type Logger } from '@aztec/foundation/log';
|
|
7
7
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
8
8
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
|
-
import { type InBlock, type L2Block, type L2BlockSource, type L2Tips
|
|
10
|
-
import { type ContractClassPublic, type ContractDataSource, type ContractInstanceWithAddress
|
|
9
|
+
import { type InBlock, type L2Block, type L2BlockSource, type L2Tips } from '@aztec/stdlib/block';
|
|
10
|
+
import { type ContractClassPublic, type ContractDataSource, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
11
11
|
import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
12
12
|
import type { GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
|
|
13
13
|
import type { L2LogsSource } from '@aztec/stdlib/interfaces/server';
|
|
@@ -19,10 +19,11 @@ import { EventEmitter } from 'events';
|
|
|
19
19
|
import type { ArchiverDataStore } from './archiver_store.js';
|
|
20
20
|
import type { ArchiverConfig } from './config.js';
|
|
21
21
|
import { ArchiverInstrumentation } from './instrumentation.js';
|
|
22
|
+
import type { PublishedL2Block } from './structs/published.js';
|
|
22
23
|
/**
|
|
23
24
|
* Helper interface to combine all sources this archiver implementation provides.
|
|
24
25
|
*/
|
|
25
|
-
export type ArchiveSource = L2BlockSource & L2LogsSource & ContractDataSource & L1ToL2MessageSource
|
|
26
|
+
export type ArchiveSource = L2BlockSource & L2LogsSource & ContractDataSource & L1ToL2MessageSource;
|
|
26
27
|
/**
|
|
27
28
|
* Pulls L2 blocks in a non-blocking manner and provides interface for their retrieval.
|
|
28
29
|
* Responsible for handling robust L1 polling so that other components do not need to
|
|
@@ -106,6 +107,7 @@ export declare class Archiver extends EventEmitter implements ArchiveSource, Tra
|
|
|
106
107
|
getL2SlotNumber(): Promise<bigint>;
|
|
107
108
|
getL2EpochNumber(): Promise<bigint>;
|
|
108
109
|
getBlocksForEpoch(epochNumber: bigint): Promise<L2Block[]>;
|
|
110
|
+
getBlockHeadersForEpoch(epochNumber: bigint): Promise<BlockHeader[]>;
|
|
109
111
|
isEpochComplete(epochNumber: bigint): Promise<boolean>;
|
|
110
112
|
/**
|
|
111
113
|
* Gets up to `limit` amount of L2 blocks starting from `from`.
|
|
@@ -115,6 +117,8 @@ export declare class Archiver extends EventEmitter implements ArchiveSource, Tra
|
|
|
115
117
|
* @returns The requested L2 blocks.
|
|
116
118
|
*/
|
|
117
119
|
getBlocks(from: number, limit: number, proven?: boolean): Promise<L2Block[]>;
|
|
120
|
+
/** Equivalent to getBlocks but includes publish data. */
|
|
121
|
+
getPublishedBlocks(from: number, limit: number, proven?: boolean): Promise<PublishedL2Block[]>;
|
|
118
122
|
/**
|
|
119
123
|
* Gets an l2 block.
|
|
120
124
|
* @param number - The block number to return.
|
|
@@ -124,13 +128,6 @@ export declare class Archiver extends EventEmitter implements ArchiveSource, Tra
|
|
|
124
128
|
getBlockHeader(number: number | 'latest'): Promise<BlockHeader | undefined>;
|
|
125
129
|
getTxEffect(txHash: TxHash): Promise<InBlock<TxEffect> | undefined>;
|
|
126
130
|
getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined>;
|
|
127
|
-
/**
|
|
128
|
-
* Gets the public function data for a contract.
|
|
129
|
-
* @param address - The contract address containing the function to fetch.
|
|
130
|
-
* @param selector - The function selector of the function to fetch.
|
|
131
|
-
* @returns The public function data (if found).
|
|
132
|
-
*/
|
|
133
|
-
getPublicFunction(address: AztecAddress, selector: FunctionSelector): Promise<PublicFunction | undefined>;
|
|
134
131
|
/**
|
|
135
132
|
* Retrieves all private logs from up to `limit` blocks, starting from the block number `from`.
|
|
136
133
|
* @param from - The block number from which to begin retrieving logs.
|
|
@@ -145,14 +142,6 @@ export declare class Archiver extends EventEmitter implements ArchiveSource, Tra
|
|
|
145
142
|
* that tag.
|
|
146
143
|
*/
|
|
147
144
|
getLogsByTags(tags: Fr[]): Promise<TxScopedL2Log[][]>;
|
|
148
|
-
/**
|
|
149
|
-
* Returns the provided nullifier indexes scoped to the block
|
|
150
|
-
* they were first included in, or undefined if they're not present in the tree
|
|
151
|
-
* @param blockNumber Max block number to search for the nullifiers
|
|
152
|
-
* @param nullifiers Nullifiers to get
|
|
153
|
-
* @returns The block scoped indexes of the provided nullifiers, or undefined if the nullifier doesn't exist in the tree
|
|
154
|
-
*/
|
|
155
|
-
findNullifiersIndexesWithBlock(blockNumber: number, nullifiers: Fr[]): Promise<(InBlock<bigint> | undefined)[]>;
|
|
156
145
|
/**
|
|
157
146
|
* Gets public logs based on the provided filter.
|
|
158
147
|
* @param filter - The filter to apply to the logs.
|
|
@@ -175,7 +164,7 @@ export declare class Archiver extends EventEmitter implements ArchiveSource, Tra
|
|
|
175
164
|
setProvenBlockNumber(blockNumber: number): Promise<void>;
|
|
176
165
|
getContractClass(id: Fr): Promise<ContractClassPublic | undefined>;
|
|
177
166
|
getBytecodeCommitment(id: Fr): Promise<Fr | undefined>;
|
|
178
|
-
getContract(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
167
|
+
getContract(address: AztecAddress, blockNumber?: number): Promise<ContractInstanceWithAddress | undefined>;
|
|
179
168
|
/**
|
|
180
169
|
* Gets L1 to L2 message (to be) included in a given block.
|
|
181
170
|
* @param blockNumber - L2 block number to get messages for.
|
|
@@ -189,7 +178,6 @@ export declare class Archiver extends EventEmitter implements ArchiveSource, Tra
|
|
|
189
178
|
*/
|
|
190
179
|
getL1ToL2MessageIndex(l1ToL2Message: Fr): Promise<bigint | undefined>;
|
|
191
180
|
getContractClassIds(): Promise<Fr[]>;
|
|
192
|
-
addContractClass(contractClass: ContractClassPublic): Promise<void>;
|
|
193
181
|
registerContractFunctionSignatures(address: AztecAddress, signatures: string[]): Promise<void>;
|
|
194
182
|
getContractFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
195
183
|
getL2Tips(): Promise<L2Tips>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archiver.d.ts","sourceRoot":"","sources":["../../src/archiver/archiver.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,
|
|
1
|
+
{"version":3,"file":"archiver.d.ts","sourceRoot":"","sources":["../../src/archiver/archiver.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAkB,KAAK,gBAAgB,EAAuB,MAAM,iBAAiB,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAclE,OAAO,KA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E,EAAE,CAAC;IAIpC,kCAAkC,CAAC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9F,uBAAuB,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAIjG,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;CAuCnC"}
|
|
@@ -4,13 +4,13 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
4
4
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
}
|
|
7
|
-
import { createEthereumChain } from '@aztec/ethereum';
|
|
7
|
+
import { RollupContract, createEthereumChain } from '@aztec/ethereum';
|
|
8
8
|
import { Fr } from '@aztec/foundation/fields';
|
|
9
9
|
import { createLogger } from '@aztec/foundation/log';
|
|
10
10
|
import { RunningPromise, makeLoggingErrorHandler } from '@aztec/foundation/running-promise';
|
|
11
11
|
import { count } from '@aztec/foundation/string';
|
|
12
12
|
import { elapsed } from '@aztec/foundation/timer';
|
|
13
|
-
import { InboxAbi
|
|
13
|
+
import { InboxAbi } from '@aztec/l1-artifacts';
|
|
14
14
|
import { ContractClassRegisteredEvent, PrivateFunctionBroadcastedEvent, UnconstrainedFunctionBroadcastedEvent } from '@aztec/protocol-contracts/class-registerer';
|
|
15
15
|
import { ContractInstanceDeployedEvent, ContractInstanceUpdatedEvent } from '@aztec/protocol-contracts/instance-deployer';
|
|
16
16
|
import { L2BlockSourceEvents } from '@aztec/stdlib/block';
|
|
@@ -58,11 +58,7 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
58
58
|
super(), this.publicClient = publicClient, this.l1Addresses = l1Addresses, this.dataStore = dataStore, this.config = config, this.blobSinkClient = blobSinkClient, this.instrumentation = instrumentation, this.l1constants = l1constants, this.log = log;
|
|
59
59
|
this.tracer = instrumentation.tracer;
|
|
60
60
|
this.store = new ArchiverStoreHelper(dataStore);
|
|
61
|
-
this.rollup =
|
|
62
|
-
address: l1Addresses.rollupAddress.toString(),
|
|
63
|
-
abi: RollupAbi,
|
|
64
|
-
client: publicClient
|
|
65
|
-
});
|
|
61
|
+
this.rollup = new RollupContract(publicClient, l1Addresses.rollupAddress);
|
|
66
62
|
this.inbox = getContract({
|
|
67
63
|
address: l1Addresses.inboxAddress.toString(),
|
|
68
64
|
abi: InboxAbi,
|
|
@@ -82,14 +78,10 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
82
78
|
transport: fallback(config.l1RpcUrls.map((url)=>http(url))),
|
|
83
79
|
pollingInterval: config.viemPollingIntervalMS
|
|
84
80
|
});
|
|
85
|
-
const rollup =
|
|
86
|
-
address: config.l1Contracts.rollupAddress.toString(),
|
|
87
|
-
abi: RollupAbi,
|
|
88
|
-
client: publicClient
|
|
89
|
-
});
|
|
81
|
+
const rollup = new RollupContract(publicClient, config.l1Contracts.rollupAddress);
|
|
90
82
|
const [l1StartBlock, l1GenesisTime] = await Promise.all([
|
|
91
|
-
rollup.
|
|
92
|
-
rollup.
|
|
83
|
+
rollup.getL1StartBlock(),
|
|
84
|
+
rollup.getL1GenesisTime()
|
|
93
85
|
]);
|
|
94
86
|
const { aztecEpochDuration: epochDuration, aztecSlotDuration: slotDuration, ethereumSlotDuration } = config;
|
|
95
87
|
const archiver = new Archiver(publicClient, config.l1Contracts, archiverStore, {
|
|
@@ -198,9 +190,7 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
198
190
|
}
|
|
199
191
|
/** Queries the rollup contract on whether a prune can be executed on the immediatenext L1 block. */ async canPrune(currentL1BlockNumber, currentL1Timestamp) {
|
|
200
192
|
const time = (currentL1Timestamp ?? 0n) + BigInt(this.l1constants.ethereumSlotDuration);
|
|
201
|
-
return await this.rollup.
|
|
202
|
-
time
|
|
203
|
-
], {
|
|
193
|
+
return await this.rollup.canPruneAtTime(time, {
|
|
204
194
|
blockNumber: currentL1BlockNumber
|
|
205
195
|
});
|
|
206
196
|
}
|
|
@@ -273,9 +263,7 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
273
263
|
}
|
|
274
264
|
async handleL2blocks(blocksSynchedTo, currentL1BlockNumber) {
|
|
275
265
|
const localPendingBlockNumber = BigInt(await this.getBlockNumber());
|
|
276
|
-
const [provenBlockNumber, provenArchive, pendingBlockNumber, pendingArchive, archiveForLocalPendingBlockNumber] = await this.rollup.
|
|
277
|
-
localPendingBlockNumber
|
|
278
|
-
], {
|
|
266
|
+
const [provenBlockNumber, provenArchive, pendingBlockNumber, pendingArchive, archiveForLocalPendingBlockNumber] = await this.rollup.status(localPendingBlockNumber, {
|
|
279
267
|
blockNumber: currentL1BlockNumber
|
|
280
268
|
});
|
|
281
269
|
const updateProvenBlock = async ()=>{
|
|
@@ -302,7 +290,7 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
302
290
|
const noBlocks = localPendingBlockNumber === 0n && pendingBlockNumber === 0n;
|
|
303
291
|
if (noBlocks) {
|
|
304
292
|
await this.store.setBlockSynchedL1BlockNumber(currentL1BlockNumber);
|
|
305
|
-
this.log.debug(`No blocks to retrieve from ${blocksSynchedTo + 1n} to ${currentL1BlockNumber}`);
|
|
293
|
+
this.log.debug(`No blocks to retrieve from ${blocksSynchedTo + 1n} to ${currentL1BlockNumber}, no blocks on chain`);
|
|
306
294
|
return {
|
|
307
295
|
provenBlockNumber
|
|
308
296
|
};
|
|
@@ -317,7 +305,14 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
317
305
|
}
|
|
318
306
|
const noBlockSinceLast = localPendingBlock && pendingArchive === localPendingBlock.archive.root.toString();
|
|
319
307
|
if (noBlockSinceLast) {
|
|
320
|
-
|
|
308
|
+
// We believe the following line causes a problem when we encounter L1 re-orgs.
|
|
309
|
+
// Basically, by setting the synched L1 block number here, we are saying that we have
|
|
310
|
+
// processed all blocks up to the current L1 block number and we will not attempt to retrieve logs from
|
|
311
|
+
// this block again (or any blocks before).
|
|
312
|
+
// However, in the re-org scenario, our L1 node is temporarily lying to us and we end up potentially missing blocks
|
|
313
|
+
// We must only set this block number based on actually retrieved logs.
|
|
314
|
+
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/8621): Tackle this properly when we handle L1 Re-orgs.
|
|
315
|
+
//await this.store.setBlockSynchedL1BlockNumber(currentL1BlockNumber);
|
|
321
316
|
this.log.debug(`No blocks to retrieve from ${blocksSynchedTo + 1n} to ${currentL1BlockNumber}`);
|
|
322
317
|
return {
|
|
323
318
|
provenBlockNumber
|
|
@@ -336,9 +331,7 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
336
331
|
if (candidateBlock === undefined) {
|
|
337
332
|
break;
|
|
338
333
|
}
|
|
339
|
-
const archiveAtContract = await this.rollup.
|
|
340
|
-
BigInt(candidateBlock.number)
|
|
341
|
-
]);
|
|
334
|
+
const archiveAtContract = await this.rollup.archiveAt(BigInt(candidateBlock.number));
|
|
342
335
|
if (archiveAtContract === candidateBlock.archive.root.toString()) {
|
|
343
336
|
break;
|
|
344
337
|
}
|
|
@@ -349,15 +342,15 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
349
342
|
this.log.warn(`Unwound ${count(blocksToUnwind, 'block')} from L2 block ${localPendingBlockNumber} ` + `due to mismatched block hashes at L1 block ${currentL1BlockNumber}. ` + `Updated L2 latest block is ${await this.getBlockNumber()}.`);
|
|
350
343
|
}
|
|
351
344
|
}
|
|
352
|
-
// Retrieve L2 blocks in batches. Each batch is estimated to
|
|
345
|
+
// Retrieve L2 blocks in batches. Each batch is estimated to accommodate up to L2 'blockBatchSize' blocks,
|
|
353
346
|
// computed using the L2 block time vs the L1 block time.
|
|
354
347
|
let searchStartBlock = blocksSynchedTo;
|
|
355
348
|
let searchEndBlock = blocksSynchedTo;
|
|
356
349
|
do {
|
|
357
350
|
[searchStartBlock, searchEndBlock] = this.nextRange(searchEndBlock, currentL1BlockNumber);
|
|
358
351
|
this.log.trace(`Retrieving L2 blocks from L1 block ${searchStartBlock} to ${searchEndBlock}`);
|
|
359
|
-
// TODO(md):
|
|
360
|
-
const retrievedBlocks = await retrieveBlocksFromRollup(this.rollup, this.publicClient, this.blobSinkClient, searchStartBlock, searchEndBlock, this.log);
|
|
352
|
+
// TODO(md): Retrieve from blob sink then from consensus client, then from peers
|
|
353
|
+
const retrievedBlocks = await retrieveBlocksFromRollup(this.rollup.getContract(), this.publicClient, this.blobSinkClient, searchStartBlock, searchEndBlock, this.log);
|
|
361
354
|
if (retrievedBlocks.length === 0) {
|
|
362
355
|
// We are not calling `setBlockSynchedL1BlockNumber` because it may cause sync issues if based off infura.
|
|
363
356
|
// See further details in earlier comments.
|
|
@@ -367,21 +360,21 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
367
360
|
const lastProcessedL1BlockNumber = retrievedBlocks[retrievedBlocks.length - 1].l1.blockNumber;
|
|
368
361
|
this.log.debug(`Retrieved ${retrievedBlocks.length} new L2 blocks between L1 blocks ${searchStartBlock} and ${searchEndBlock} with last processed L1 block ${lastProcessedL1BlockNumber}.`);
|
|
369
362
|
for (const block of retrievedBlocks){
|
|
370
|
-
this.log.debug(`Ingesting new L2 block ${block.
|
|
371
|
-
blockHash: block.
|
|
363
|
+
this.log.debug(`Ingesting new L2 block ${block.block.number} with ${block.block.body.txEffects.length} txs`, {
|
|
364
|
+
blockHash: block.block.hash(),
|
|
372
365
|
l1BlockNumber: block.l1.blockNumber,
|
|
373
|
-
...block.
|
|
374
|
-
...block.
|
|
366
|
+
...block.block.header.globalVariables.toInspect(),
|
|
367
|
+
...block.block.getStats()
|
|
375
368
|
});
|
|
376
369
|
}
|
|
377
370
|
const [processDuration] = await elapsed(()=>this.store.addBlocks(retrievedBlocks));
|
|
378
|
-
this.instrumentation.processNewBlocks(processDuration / retrievedBlocks.length, retrievedBlocks.map((b)=>b.
|
|
371
|
+
this.instrumentation.processNewBlocks(processDuration / retrievedBlocks.length, retrievedBlocks.map((b)=>b.block));
|
|
379
372
|
for (const block of retrievedBlocks){
|
|
380
|
-
this.log.info(`Downloaded L2 block ${block.
|
|
381
|
-
blockHash: block.
|
|
382
|
-
blockNumber: block.
|
|
383
|
-
txCount: block.
|
|
384
|
-
globalVariables: block.
|
|
373
|
+
this.log.info(`Downloaded L2 block ${block.block.number}`, {
|
|
374
|
+
blockHash: block.block.hash(),
|
|
375
|
+
blockNumber: block.block.number,
|
|
376
|
+
txCount: block.block.body.txEffects.length,
|
|
377
|
+
globalVariables: block.block.header.globalVariables.toInspect()
|
|
385
378
|
});
|
|
386
379
|
}
|
|
387
380
|
}while (searchEndBlock < currentL1BlockNumber)
|
|
@@ -444,6 +437,22 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
444
437
|
}
|
|
445
438
|
return blocks.reverse();
|
|
446
439
|
}
|
|
440
|
+
async getBlockHeadersForEpoch(epochNumber) {
|
|
441
|
+
const [start, end] = getSlotRangeForEpoch(epochNumber, this.l1constants);
|
|
442
|
+
const blocks = [];
|
|
443
|
+
// Walk the list of blocks backwards and filter by slots matching the requested epoch.
|
|
444
|
+
// We'll typically ask for blocks for a very recent epoch, so we shouldn't need an index here.
|
|
445
|
+
let number = await this.store.getSynchedL2BlockNumber();
|
|
446
|
+
let header = await this.getBlockHeader(number);
|
|
447
|
+
const slot = (b)=>b.globalVariables.slotNumber.toBigInt();
|
|
448
|
+
while(header && slot(header) >= start){
|
|
449
|
+
if (slot(header) <= end) {
|
|
450
|
+
blocks.push(header);
|
|
451
|
+
}
|
|
452
|
+
header = await this.getBlockHeader(--number);
|
|
453
|
+
}
|
|
454
|
+
return blocks.reverse();
|
|
455
|
+
}
|
|
447
456
|
async isEpochComplete(epochNumber) {
|
|
448
457
|
// The epoch is complete if the current L2 block is the last one in the epoch (or later)
|
|
449
458
|
const header = await this.getBlockHeader('latest');
|
|
@@ -474,9 +483,12 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
474
483
|
* @param limit - The number of blocks to return.
|
|
475
484
|
* @param proven - If true, only return blocks that have been proven.
|
|
476
485
|
* @returns The requested L2 blocks.
|
|
477
|
-
*/
|
|
486
|
+
*/ getBlocks(from, limit, proven) {
|
|
487
|
+
return this.getPublishedBlocks(from, limit, proven).then((blocks)=>blocks.map((b)=>b.block));
|
|
488
|
+
}
|
|
489
|
+
/** Equivalent to getBlocks but includes publish data. */ async getPublishedBlocks(from, limit, proven) {
|
|
478
490
|
const limitWithProven = proven ? Math.min(limit, Math.max(await this.store.getProvenL2BlockNumber() - from + 1, 0)) : limit;
|
|
479
|
-
return limitWithProven === 0 ? [] :
|
|
491
|
+
return limitWithProven === 0 ? [] : await this.store.getBlocks(from, limitWithProven);
|
|
480
492
|
}
|
|
481
493
|
/**
|
|
482
494
|
* Gets an l2 block.
|
|
@@ -491,7 +503,7 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
491
503
|
return undefined;
|
|
492
504
|
}
|
|
493
505
|
const blocks = await this.store.getBlocks(number, 1);
|
|
494
|
-
return blocks.length === 0 ? undefined : blocks[0].
|
|
506
|
+
return blocks.length === 0 ? undefined : blocks[0].block;
|
|
495
507
|
}
|
|
496
508
|
async getBlockHeader(number) {
|
|
497
509
|
if (number === 'latest') {
|
|
@@ -510,22 +522,6 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
510
522
|
return this.store.getSettledTxReceipt(txHash);
|
|
511
523
|
}
|
|
512
524
|
/**
|
|
513
|
-
* Gets the public function data for a contract.
|
|
514
|
-
* @param address - The contract address containing the function to fetch.
|
|
515
|
-
* @param selector - The function selector of the function to fetch.
|
|
516
|
-
* @returns The public function data (if found).
|
|
517
|
-
*/ async getPublicFunction(address, selector) {
|
|
518
|
-
const instance = await this.getContract(address);
|
|
519
|
-
if (!instance) {
|
|
520
|
-
throw new Error(`Contract ${address.toString()} not found`);
|
|
521
|
-
}
|
|
522
|
-
const contractClass = await this.getContractClass(instance.currentContractClassId);
|
|
523
|
-
if (!contractClass) {
|
|
524
|
-
throw new Error(`Contract class ${instance.currentContractClassId.toString()} for ${address.toString()} not found`);
|
|
525
|
-
}
|
|
526
|
-
return contractClass.publicFunctions.find((f)=>f.selector.equals(selector));
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
525
|
* Retrieves all private logs from up to `limit` blocks, starting from the block number `from`.
|
|
530
526
|
* @param from - The block number from which to begin retrieving logs.
|
|
531
527
|
* @param limit - The maximum number of blocks to retrieve logs from.
|
|
@@ -542,15 +538,6 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
542
538
|
return this.store.getLogsByTags(tags);
|
|
543
539
|
}
|
|
544
540
|
/**
|
|
545
|
-
* Returns the provided nullifier indexes scoped to the block
|
|
546
|
-
* they were first included in, or undefined if they're not present in the tree
|
|
547
|
-
* @param blockNumber Max block number to search for the nullifiers
|
|
548
|
-
* @param nullifiers Nullifiers to get
|
|
549
|
-
* @returns The block scoped indexes of the provided nullifiers, or undefined if the nullifier doesn't exist in the tree
|
|
550
|
-
*/ findNullifiersIndexesWithBlock(blockNumber, nullifiers) {
|
|
551
|
-
return this.store.findNullifiersIndexesWithBlock(blockNumber, nullifiers);
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
541
|
* Gets public logs based on the provided filter.
|
|
555
542
|
* @param filter - The filter to apply to the logs.
|
|
556
543
|
* @returns The requested logs.
|
|
@@ -582,8 +569,8 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
582
569
|
getBytecodeCommitment(id) {
|
|
583
570
|
return this.store.getBytecodeCommitment(id);
|
|
584
571
|
}
|
|
585
|
-
getContract(address) {
|
|
586
|
-
return this.store.getContractInstance(address);
|
|
572
|
+
async getContract(address, blockNumber) {
|
|
573
|
+
return this.store.getContractInstance(address, blockNumber ?? await this.getBlockNumber());
|
|
587
574
|
}
|
|
588
575
|
/**
|
|
589
576
|
* Gets L1 to L2 message (to be) included in a given block.
|
|
@@ -602,15 +589,6 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
602
589
|
getContractClassIds() {
|
|
603
590
|
return this.store.getContractClassIds();
|
|
604
591
|
}
|
|
605
|
-
// TODO(#10007): Remove this method
|
|
606
|
-
async addContractClass(contractClass) {
|
|
607
|
-
await this.store.addContractClasses([
|
|
608
|
-
contractClass
|
|
609
|
-
], [
|
|
610
|
-
await computePublicBytecodeCommitment(contractClass.packedBytecode)
|
|
611
|
-
], 0);
|
|
612
|
-
return;
|
|
613
|
-
}
|
|
614
592
|
registerContractFunctionSignatures(address, signatures) {
|
|
615
593
|
return this.store.registerContractFunctionSignatures(address, signatures);
|
|
616
594
|
}
|
|
@@ -673,10 +651,6 @@ var Operation = /*#__PURE__*/ function(Operation) {
|
|
|
673
651
|
this.store = store;
|
|
674
652
|
this.#log = createLogger('archiver:block-helper');
|
|
675
653
|
}
|
|
676
|
-
// TODO(#10007): Remove this method
|
|
677
|
-
addContractClasses(contractClasses, bytecodeCommitments, blockNum) {
|
|
678
|
-
return this.store.addContractClasses(contractClasses, bytecodeCommitments, blockNum);
|
|
679
|
-
}
|
|
680
654
|
/**
|
|
681
655
|
* Extracts and stores contract classes out of ContractClassRegistered events emitted by the class registerer contract.
|
|
682
656
|
* @param allLogs - All logs emitted in a bunch of blocks.
|
|
@@ -777,21 +751,20 @@ var Operation = /*#__PURE__*/ function(Operation) {
|
|
|
777
751
|
}
|
|
778
752
|
async addBlocks(blocks) {
|
|
779
753
|
const opResults = await Promise.all([
|
|
780
|
-
this.store.addLogs(blocks.map((block)=>block.
|
|
754
|
+
this.store.addLogs(blocks.map((block)=>block.block)),
|
|
781
755
|
// Unroll all logs emitted during the retrieved blocks and extract any contract classes and instances from them
|
|
782
756
|
...blocks.map(async (block)=>{
|
|
783
|
-
const contractClassLogs = block.
|
|
757
|
+
const contractClassLogs = block.block.body.txEffects.flatMap((txEffect)=>txEffect.contractClassLogs);
|
|
784
758
|
// ContractInstanceDeployed event logs are broadcast in privateLogs.
|
|
785
|
-
const privateLogs = block.
|
|
786
|
-
const publicLogs = block.
|
|
759
|
+
const privateLogs = block.block.body.txEffects.flatMap((txEffect)=>txEffect.privateLogs);
|
|
760
|
+
const publicLogs = block.block.body.txEffects.flatMap((txEffect)=>txEffect.publicLogs);
|
|
787
761
|
return (await Promise.all([
|
|
788
|
-
this.#updateRegisteredContractClasses(contractClassLogs, block.
|
|
789
|
-
this.#updateDeployedContractInstances(privateLogs, block.
|
|
790
|
-
this.#updateUpdatedContractInstances(publicLogs, block.
|
|
791
|
-
this.#storeBroadcastedIndividualFunctions(contractClassLogs, block.
|
|
762
|
+
this.#updateRegisteredContractClasses(contractClassLogs, block.block.number, 0),
|
|
763
|
+
this.#updateDeployedContractInstances(privateLogs, block.block.number, 0),
|
|
764
|
+
this.#updateUpdatedContractInstances(publicLogs, block.block.number, 0),
|
|
765
|
+
this.#storeBroadcastedIndividualFunctions(contractClassLogs, block.block.number)
|
|
792
766
|
])).every(Boolean);
|
|
793
767
|
}),
|
|
794
|
-
this.store.addNullifiers(blocks.map((block)=>block.data)),
|
|
795
768
|
this.store.addBlocks(blocks)
|
|
796
769
|
]);
|
|
797
770
|
return opResults.every(Boolean);
|
|
@@ -806,17 +779,17 @@ var Operation = /*#__PURE__*/ function(Operation) {
|
|
|
806
779
|
const opResults = await Promise.all([
|
|
807
780
|
// Unroll all logs emitted during the retrieved blocks and extract any contract classes and instances from them
|
|
808
781
|
...blocks.map(async (block)=>{
|
|
809
|
-
const contractClassLogs = block.
|
|
782
|
+
const contractClassLogs = block.block.body.txEffects.flatMap((txEffect)=>txEffect.contractClassLogs);
|
|
810
783
|
// ContractInstanceDeployed event logs are broadcast in privateLogs.
|
|
811
|
-
const privateLogs = block.
|
|
812
|
-
const publicLogs = block.
|
|
784
|
+
const privateLogs = block.block.body.txEffects.flatMap((txEffect)=>txEffect.privateLogs);
|
|
785
|
+
const publicLogs = block.block.body.txEffects.flatMap((txEffect)=>txEffect.publicLogs);
|
|
813
786
|
return (await Promise.all([
|
|
814
|
-
this.#updateRegisteredContractClasses(contractClassLogs, block.
|
|
815
|
-
this.#updateDeployedContractInstances(privateLogs, block.
|
|
816
|
-
this.#updateUpdatedContractInstances(publicLogs, block.
|
|
787
|
+
this.#updateRegisteredContractClasses(contractClassLogs, block.block.number, 1),
|
|
788
|
+
this.#updateDeployedContractInstances(privateLogs, block.block.number, 1),
|
|
789
|
+
this.#updateUpdatedContractInstances(publicLogs, block.block.number, 1)
|
|
817
790
|
])).every(Boolean);
|
|
818
791
|
}),
|
|
819
|
-
this.store.deleteLogs(blocks.map((b)=>b.
|
|
792
|
+
this.store.deleteLogs(blocks.map((b)=>b.block)),
|
|
820
793
|
this.store.unwindBlocks(from, blocksToUnwind)
|
|
821
794
|
]);
|
|
822
795
|
return opResults.every(Boolean);
|
|
@@ -848,9 +821,6 @@ var Operation = /*#__PURE__*/ function(Operation) {
|
|
|
848
821
|
getLogsByTags(tags) {
|
|
849
822
|
return this.store.getLogsByTags(tags);
|
|
850
823
|
}
|
|
851
|
-
findNullifiersIndexesWithBlock(blockNumber, nullifiers) {
|
|
852
|
-
return this.store.findNullifiersIndexesWithBlock(blockNumber, nullifiers);
|
|
853
|
-
}
|
|
854
824
|
getPublicLogs(filter) {
|
|
855
825
|
return this.store.getPublicLogs(filter);
|
|
856
826
|
}
|
|
@@ -881,8 +851,8 @@ var Operation = /*#__PURE__*/ function(Operation) {
|
|
|
881
851
|
getBytecodeCommitment(contractClassId) {
|
|
882
852
|
return this.store.getBytecodeCommitment(contractClassId);
|
|
883
853
|
}
|
|
884
|
-
getContractInstance(address) {
|
|
885
|
-
return this.store.getContractInstance(address);
|
|
854
|
+
getContractInstance(address, blockNumber) {
|
|
855
|
+
return this.store.getContractInstance(address, blockNumber);
|
|
886
856
|
}
|
|
887
857
|
getContractClassIds() {
|
|
888
858
|
return this.store.getContractClassIds();
|
|
@@ -8,7 +8,7 @@ import type { LogFilter, PrivateLog, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
|
8
8
|
import type { InboxLeaf } from '@aztec/stdlib/messaging';
|
|
9
9
|
import { BlockHeader, type TxEffect, type TxHash, type TxReceipt } from '@aztec/stdlib/tx';
|
|
10
10
|
import type { DataRetrieval } from './structs/data_retrieval.js';
|
|
11
|
-
import type {
|
|
11
|
+
import type { PublishedL2Block } from './structs/published.js';
|
|
12
12
|
/**
|
|
13
13
|
* Represents the latest L1 block processed by the archiver for various objects in L2.
|
|
14
14
|
*/
|
|
@@ -30,7 +30,7 @@ export interface ArchiverDataStore {
|
|
|
30
30
|
* @param blocks - The L2 blocks to be added to the store and the last processed L1 block.
|
|
31
31
|
* @returns True if the operation is successful.
|
|
32
32
|
*/
|
|
33
|
-
addBlocks(blocks:
|
|
33
|
+
addBlocks(blocks: PublishedL2Block[]): Promise<boolean>;
|
|
34
34
|
/**
|
|
35
35
|
* Unwinds blocks from the database
|
|
36
36
|
* @param from - The tip of the chain, passed for verification purposes,
|
|
@@ -45,7 +45,7 @@ export interface ArchiverDataStore {
|
|
|
45
45
|
* @param limit - The number of blocks to return.
|
|
46
46
|
* @returns The requested L2 blocks.
|
|
47
47
|
*/
|
|
48
|
-
getBlocks(from: number, limit: number): Promise<
|
|
48
|
+
getBlocks(from: number, limit: number): Promise<PublishedL2Block[]>;
|
|
49
49
|
/**
|
|
50
50
|
* Gets up to `limit` amount of L2 block headers starting from `from`.
|
|
51
51
|
* @param from - Number of the first block to return (inclusive).
|
|
@@ -72,21 +72,6 @@ export interface ArchiverDataStore {
|
|
|
72
72
|
*/
|
|
73
73
|
addLogs(blocks: L2Block[]): Promise<boolean>;
|
|
74
74
|
deleteLogs(blocks: L2Block[]): Promise<boolean>;
|
|
75
|
-
/**
|
|
76
|
-
* Append new nullifiers to the store's list.
|
|
77
|
-
* @param blocks - The blocks for which to add the nullifiers.
|
|
78
|
-
* @returns True if the operation is successful.
|
|
79
|
-
*/
|
|
80
|
-
addNullifiers(blocks: L2Block[]): Promise<boolean>;
|
|
81
|
-
deleteNullifiers(blocks: L2Block[]): Promise<boolean>;
|
|
82
|
-
/**
|
|
83
|
-
* Returns the provided nullifier indexes scoped to the block
|
|
84
|
-
* they were first included in, or undefined if they're not present in the tree
|
|
85
|
-
* @param blockNumber Max block number to search for the nullifiers
|
|
86
|
-
* @param nullifiers Nullifiers to get
|
|
87
|
-
* @returns The block scoped indexes of the provided nullifiers, or undefined if the nullifier doesn't exist in the tree
|
|
88
|
-
*/
|
|
89
|
-
findNullifiersIndexesWithBlock(blockNumber: number, nullifiers: Fr[]): Promise<(InBlock<bigint> | undefined)[]>;
|
|
90
75
|
/**
|
|
91
76
|
* Append L1 to L2 messages to the store.
|
|
92
77
|
* @param messages - The L1 to L2 messages to be added to the store and the last processed L1 block.
|
|
@@ -202,8 +187,9 @@ export interface ArchiverDataStore {
|
|
|
202
187
|
/**
|
|
203
188
|
* Returns a contract instance given its address and the given block number, or undefined if not exists.
|
|
204
189
|
* @param address - Address of the contract.
|
|
190
|
+
* @param blockNumber - Block number to get the contract instance at. Contract updates might change the instance at a given block.
|
|
205
191
|
*/
|
|
206
|
-
getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
192
|
+
getContractInstance(address: AztecAddress, blockNumber: number): Promise<ContractInstanceWithAddress | undefined>;
|
|
207
193
|
/** Returns the list of all class ids known by the archiver. */
|
|
208
194
|
getContractClassIds(): Promise<Fr[]>;
|
|
209
195
|
registerContractFunctionSignatures(address: AztecAddress, signatures: string[]): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archiver_store.d.ts","sourceRoot":"","sources":["../../src/archiver/archiver_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM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,CAAC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC,CAAC;IAElH,+DAA+D;IAC/D,mBAAmB,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IAKrC,kCAAkC,CAAC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,uBAAuB,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAExG;;OAEG;IACH,YAAY,IAAI,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archiver_store_test_suite.d.ts","sourceRoot":"","sources":["../../src/archiver/archiver_store_test_suite.ts"],"names":[],"mappings":"AAyBA,OAAO,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,iBAAiB,EAAwB,MAAM,qBAAqB,CAAC;AAGnF;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"archiver_store_test_suite.d.ts","sourceRoot":"","sources":["../../src/archiver/archiver_store_test_suite.ts"],"names":[],"mappings":"AAyBA,OAAO,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,iBAAiB,EAAwB,MAAM,qBAAqB,CAAC;AAGnF;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,QAquB/D"}
|