@aztec/archiver 0.81.0 → 0.82.1-alpha-testnet.1
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 +4 -12
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +41 -58
- package/dest/archiver/archiver_store.d.ts +1 -16
- 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 +1 -51
- 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/index.d.ts +0 -1
- package/dest/archiver/index.d.ts.map +1 -1
- package/dest/archiver/index.js +0 -1
- package/dest/archiver/kv_archiver_store/contract_class_store.js +1 -8
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +3 -11
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.js +1 -17
- package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/log_store.js +2 -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 +1 -0
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +3 -0
- package/package.json +12 -13
- package/src/archiver/archiver.ts +47 -69
- package/src/archiver/archiver_store.ts +1 -18
- package/src/archiver/archiver_store_test_suite.ts +0 -54
- package/src/archiver/config.ts +8 -0
- package/src/archiver/data_retrieval.ts +1 -1
- package/src/archiver/index.ts +0 -1
- package/src/archiver/kv_archiver_store/contract_class_store.ts +0 -9
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +2 -22
- package/src/archiver/kv_archiver_store/log_store.ts +1 -0
- package/src/factory.ts +3 -28
- package/src/test/mock_l2_block_source.ts +4 -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 -607
- package/src/archiver/kv_archiver_store/nullifier_store.ts +0 -97
- package/src/archiver/memory_archiver_store/memory_archiver_store.ts +0 -770
|
@@ -6,7 +6,7 @@ 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
|
|
9
|
+
import { type InBlock, type L2Block, type L2BlockSource, type L2Tips } from '@aztec/stdlib/block';
|
|
10
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';
|
|
@@ -23,7 +23,7 @@ import type { PublishedL2Block } from './structs/published.js';
|
|
|
23
23
|
/**
|
|
24
24
|
* Helper interface to combine all sources this archiver implementation provides.
|
|
25
25
|
*/
|
|
26
|
-
export type ArchiveSource = L2BlockSource & L2LogsSource & ContractDataSource & L1ToL2MessageSource
|
|
26
|
+
export type ArchiveSource = L2BlockSource & L2LogsSource & ContractDataSource & L1ToL2MessageSource;
|
|
27
27
|
/**
|
|
28
28
|
* Pulls L2 blocks in a non-blocking manner and provides interface for their retrieval.
|
|
29
29
|
* Responsible for handling robust L1 polling so that other components do not need to
|
|
@@ -107,6 +107,7 @@ export declare class Archiver extends EventEmitter implements ArchiveSource, Tra
|
|
|
107
107
|
getL2SlotNumber(): Promise<bigint>;
|
|
108
108
|
getL2EpochNumber(): Promise<bigint>;
|
|
109
109
|
getBlocksForEpoch(epochNumber: bigint): Promise<L2Block[]>;
|
|
110
|
+
getBlockHeadersForEpoch(epochNumber: bigint): Promise<BlockHeader[]>;
|
|
110
111
|
isEpochComplete(epochNumber: bigint): Promise<boolean>;
|
|
111
112
|
/**
|
|
112
113
|
* Gets up to `limit` amount of L2 blocks starting from `from`.
|
|
@@ -141,14 +142,6 @@ export declare class Archiver extends EventEmitter implements ArchiveSource, Tra
|
|
|
141
142
|
* that tag.
|
|
142
143
|
*/
|
|
143
144
|
getLogsByTags(tags: Fr[]): Promise<TxScopedL2Log[][]>;
|
|
144
|
-
/**
|
|
145
|
-
* Returns the provided nullifier indexes scoped to the block
|
|
146
|
-
* they were first included in, or undefined if they're not present in the tree
|
|
147
|
-
* @param blockNumber Max block number to search for the nullifiers
|
|
148
|
-
* @param nullifiers Nullifiers to get
|
|
149
|
-
* @returns The block scoped indexes of the provided nullifiers, or undefined if the nullifier doesn't exist in the tree
|
|
150
|
-
*/
|
|
151
|
-
findNullifiersIndexesWithBlock(blockNumber: number, nullifiers: Fr[]): Promise<(InBlock<bigint> | undefined)[]>;
|
|
152
145
|
/**
|
|
153
146
|
* Gets public logs based on the provided filter.
|
|
154
147
|
* @param filter - The filter to apply to the logs.
|
|
@@ -185,9 +178,8 @@ export declare class Archiver extends EventEmitter implements ArchiveSource, Tra
|
|
|
185
178
|
*/
|
|
186
179
|
getL1ToL2MessageIndex(l1ToL2Message: Fr): Promise<bigint | undefined>;
|
|
187
180
|
getContractClassIds(): Promise<Fr[]>;
|
|
188
|
-
addContractClass(contractClass: ContractClassPublic): Promise<void>;
|
|
189
181
|
registerContractFunctionSignatures(address: AztecAddress, signatures: string[]): Promise<void>;
|
|
190
|
-
|
|
182
|
+
getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
191
183
|
getL2Tips(): Promise<L2Tips>;
|
|
192
184
|
}
|
|
193
185
|
//# sourceMappingURL=archiver.d.ts.map
|
|
@@ -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,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EAEZ,KAAK,aAAa,EAElB,KAAK,MAAM,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAMjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,iBAAiB,EAMvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC3G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAoB,KAAK,SAAS,EAAE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AAC;IAI9E;;;OAGG;IACI,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAIjC,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC;IAI9C,wEAAwE;IACjE,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD,gBAAgB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAIlE,qBAAqB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IAIhD,WAAW,CACtB,OAAO,EAAE,YAAY,EACrB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC;IAInD;;;;OAIG;IACH,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC;IAIrD;;;;OAIG;IACH,qBAAqB,CAAC,aAAa,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAIrE,mBAAmB,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;IAIpC,kCAAkC,CAAC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9F,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAI9F,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.
|
|
@@ -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');
|
|
@@ -529,15 +538,6 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
529
538
|
return this.store.getLogsByTags(tags);
|
|
530
539
|
}
|
|
531
540
|
/**
|
|
532
|
-
* Returns the provided nullifier indexes scoped to the block
|
|
533
|
-
* they were first included in, or undefined if they're not present in the tree
|
|
534
|
-
* @param blockNumber Max block number to search for the nullifiers
|
|
535
|
-
* @param nullifiers Nullifiers to get
|
|
536
|
-
* @returns The block scoped indexes of the provided nullifiers, or undefined if the nullifier doesn't exist in the tree
|
|
537
|
-
*/ findNullifiersIndexesWithBlock(blockNumber, nullifiers) {
|
|
538
|
-
return this.store.findNullifiersIndexesWithBlock(blockNumber, nullifiers);
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
541
|
* Gets public logs based on the provided filter.
|
|
542
542
|
* @param filter - The filter to apply to the logs.
|
|
543
543
|
* @returns The requested logs.
|
|
@@ -589,20 +589,11 @@ import { ArchiverInstrumentation } from './instrumentation.js';
|
|
|
589
589
|
getContractClassIds() {
|
|
590
590
|
return this.store.getContractClassIds();
|
|
591
591
|
}
|
|
592
|
-
// TODO(#10007): Remove this method
|
|
593
|
-
async addContractClass(contractClass) {
|
|
594
|
-
await this.store.addContractClasses([
|
|
595
|
-
contractClass
|
|
596
|
-
], [
|
|
597
|
-
await computePublicBytecodeCommitment(contractClass.packedBytecode)
|
|
598
|
-
], 0);
|
|
599
|
-
return;
|
|
600
|
-
}
|
|
601
592
|
registerContractFunctionSignatures(address, signatures) {
|
|
602
593
|
return this.store.registerContractFunctionSignatures(address, signatures);
|
|
603
594
|
}
|
|
604
|
-
|
|
605
|
-
return this.store.
|
|
595
|
+
getDebugFunctionName(address, selector) {
|
|
596
|
+
return this.store.getDebugFunctionName(address, selector);
|
|
606
597
|
}
|
|
607
598
|
async getL2Tips() {
|
|
608
599
|
const [latestBlockNumber, provenBlockNumber] = await Promise.all([
|
|
@@ -660,10 +651,6 @@ var Operation = /*#__PURE__*/ function(Operation) {
|
|
|
660
651
|
this.store = store;
|
|
661
652
|
this.#log = createLogger('archiver:block-helper');
|
|
662
653
|
}
|
|
663
|
-
// TODO(#10007): Remove this method
|
|
664
|
-
addContractClasses(contractClasses, bytecodeCommitments, blockNum) {
|
|
665
|
-
return this.store.addContractClasses(contractClasses, bytecodeCommitments, blockNum);
|
|
666
|
-
}
|
|
667
654
|
/**
|
|
668
655
|
* Extracts and stores contract classes out of ContractClassRegistered events emitted by the class registerer contract.
|
|
669
656
|
* @param allLogs - All logs emitted in a bunch of blocks.
|
|
@@ -778,7 +765,6 @@ var Operation = /*#__PURE__*/ function(Operation) {
|
|
|
778
765
|
this.#storeBroadcastedIndividualFunctions(contractClassLogs, block.block.number)
|
|
779
766
|
])).every(Boolean);
|
|
780
767
|
}),
|
|
781
|
-
this.store.addNullifiers(blocks.map((block)=>block.block)),
|
|
782
768
|
this.store.addBlocks(blocks)
|
|
783
769
|
]);
|
|
784
770
|
return opResults.every(Boolean);
|
|
@@ -835,9 +821,6 @@ var Operation = /*#__PURE__*/ function(Operation) {
|
|
|
835
821
|
getLogsByTags(tags) {
|
|
836
822
|
return this.store.getLogsByTags(tags);
|
|
837
823
|
}
|
|
838
|
-
findNullifiersIndexesWithBlock(blockNumber, nullifiers) {
|
|
839
|
-
return this.store.findNullifiersIndexesWithBlock(blockNumber, nullifiers);
|
|
840
|
-
}
|
|
841
824
|
getPublicLogs(filter) {
|
|
842
825
|
return this.store.getPublicLogs(filter);
|
|
843
826
|
}
|
|
@@ -877,8 +860,8 @@ var Operation = /*#__PURE__*/ function(Operation) {
|
|
|
877
860
|
registerContractFunctionSignatures(address, signatures) {
|
|
878
861
|
return this.store.registerContractFunctionSignatures(address, signatures);
|
|
879
862
|
}
|
|
880
|
-
|
|
881
|
-
return this.store.
|
|
863
|
+
getDebugFunctionName(address, selector) {
|
|
864
|
+
return this.store.getDebugFunctionName(address, selector);
|
|
882
865
|
}
|
|
883
866
|
getTotalL1ToL2MessageCount() {
|
|
884
867
|
return this.store.getTotalL1ToL2MessageCount();
|
|
@@ -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.
|
|
@@ -208,7 +193,7 @@ export interface ArchiverDataStore {
|
|
|
208
193
|
/** Returns the list of all class ids known by the archiver. */
|
|
209
194
|
getContractClassIds(): Promise<Fr[]>;
|
|
210
195
|
registerContractFunctionSignatures(address: AztecAddress, signatures: string[]): Promise<void>;
|
|
211
|
-
|
|
196
|
+
getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
212
197
|
/**
|
|
213
198
|
* Estimates the size of the store in bytes.
|
|
214
199
|
*/
|
|
@@ -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,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EACV,mBAAmB,EACnB,iCAAiC,EACjC,2BAA2B,EAC3B,4CAA4C,EAC5C,wCAAwC,EACzC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC3G,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MA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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":"
|
|
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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INITIAL_L2_BLOCK_NUM, L1_TO_L2_MSG_SUBTREE_HEIGHT,
|
|
1
|
+
import { INITIAL_L2_BLOCK_NUM, L1_TO_L2_MSG_SUBTREE_HEIGHT, PRIVATE_LOG_SIZE_IN_FIELDS, PUBLIC_LOG_DATA_SIZE_IN_FIELDS } from '@aztec/constants';
|
|
2
2
|
import { times, timesParallel } from '@aztec/foundation/collection';
|
|
3
3
|
import { randomInt } from '@aztec/foundation/crypto';
|
|
4
4
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
@@ -753,55 +753,5 @@ import { TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
|
753
753
|
}
|
|
754
754
|
});
|
|
755
755
|
});
|
|
756
|
-
describe('findNullifiersIndexesWithBlock', ()=>{
|
|
757
|
-
let blocks;
|
|
758
|
-
const numBlocks = 10;
|
|
759
|
-
const nullifiersPerBlock = new Map();
|
|
760
|
-
beforeEach(async ()=>{
|
|
761
|
-
blocks = await timesParallel(numBlocks, (index)=>L2Block.random(index + 1, 1));
|
|
762
|
-
blocks.forEach((block, blockIndex)=>{
|
|
763
|
-
nullifiersPerBlock.set(blockIndex, block.body.txEffects.flatMap((txEffect)=>txEffect.nullifiers));
|
|
764
|
-
});
|
|
765
|
-
});
|
|
766
|
-
it('returns wrapped nullifiers with blocks if they exist', async ()=>{
|
|
767
|
-
await store.addNullifiers(blocks);
|
|
768
|
-
const nullifiersToRetrieve = [
|
|
769
|
-
...nullifiersPerBlock.get(0),
|
|
770
|
-
...nullifiersPerBlock.get(5),
|
|
771
|
-
Fr.random()
|
|
772
|
-
];
|
|
773
|
-
const blockScopedNullifiers = await store.findNullifiersIndexesWithBlock(10, nullifiersToRetrieve);
|
|
774
|
-
expect(blockScopedNullifiers).toHaveLength(nullifiersToRetrieve.length);
|
|
775
|
-
const [undefinedNullifier] = blockScopedNullifiers.slice(-1);
|
|
776
|
-
const realNullifiers = blockScopedNullifiers.slice(0, -1);
|
|
777
|
-
realNullifiers.forEach((blockScopedNullifier, index)=>{
|
|
778
|
-
expect(blockScopedNullifier).not.toBeUndefined();
|
|
779
|
-
const { data, l2BlockNumber } = blockScopedNullifier;
|
|
780
|
-
expect(data).toEqual(expect.any(BigInt));
|
|
781
|
-
expect(l2BlockNumber).toEqual(index < MAX_NULLIFIERS_PER_TX ? 1 : 6);
|
|
782
|
-
});
|
|
783
|
-
expect(undefinedNullifier).toBeUndefined();
|
|
784
|
-
});
|
|
785
|
-
it('returns wrapped nullifiers filtering by blockNumber', async ()=>{
|
|
786
|
-
await store.addNullifiers(blocks);
|
|
787
|
-
const nullifiersToRetrieve = [
|
|
788
|
-
...nullifiersPerBlock.get(0),
|
|
789
|
-
...nullifiersPerBlock.get(5)
|
|
790
|
-
];
|
|
791
|
-
const blockScopedNullifiers = await store.findNullifiersIndexesWithBlock(5, nullifiersToRetrieve);
|
|
792
|
-
expect(blockScopedNullifiers).toHaveLength(nullifiersToRetrieve.length);
|
|
793
|
-
const undefinedNullifiers = blockScopedNullifiers.slice(-MAX_NULLIFIERS_PER_TX);
|
|
794
|
-
const realNullifiers = blockScopedNullifiers.slice(0, -MAX_NULLIFIERS_PER_TX);
|
|
795
|
-
realNullifiers.forEach((blockScopedNullifier)=>{
|
|
796
|
-
expect(blockScopedNullifier).not.toBeUndefined();
|
|
797
|
-
const { data, l2BlockNumber } = blockScopedNullifier;
|
|
798
|
-
expect(data).toEqual(expect.any(BigInt));
|
|
799
|
-
expect(l2BlockNumber).toEqual(1);
|
|
800
|
-
});
|
|
801
|
-
undefinedNullifiers.forEach((undefinedNullifier)=>{
|
|
802
|
-
expect(undefinedNullifier).toBeUndefined();
|
|
803
|
-
});
|
|
804
|
-
});
|
|
805
|
-
});
|
|
806
756
|
});
|
|
807
757
|
}
|
|
@@ -26,6 +26,8 @@ export type ArchiverConfig = {
|
|
|
26
26
|
l1Contracts: L1ContractAddresses;
|
|
27
27
|
/** The max number of logs that can be obtained in 1 "getPublicLogs" call. */
|
|
28
28
|
maxLogs?: number;
|
|
29
|
+
/** The maximum possible size of the archiver DB in KB. Overwrites the general dataStoreMapSizeKB. */
|
|
30
|
+
archiverStoreMapSizeKb?: number;
|
|
29
31
|
} & L1ReaderConfig & L1ContractsConfig & BlobSinkConfig & ChainConfig;
|
|
30
32
|
export declare const archiverConfigMappings: ConfigMappingsType<ArchiverConfig>;
|
|
31
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/archiver/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAyB,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAGpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,kBAAkB,EAA6C,MAAM,0BAA0B,CAAC;AAC9G,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,sBAAsB,CAAC;AAE7E;;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BAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,GAAG,cAAc,GAChB,iBAAiB,GACjB,cAAc,GACd,WAAW,CAAC;AAEd,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,cAAc,CAwCrE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,cAAc,CAEzD"}
|
package/dest/archiver/config.js
CHANGED
|
@@ -28,6 +28,11 @@ export const archiverConfigMappings = {
|
|
|
28
28
|
description: 'The max number of logs that can be obtained in 1 "getPublicLogs" call.',
|
|
29
29
|
...numberConfigHelper(1_000)
|
|
30
30
|
},
|
|
31
|
+
archiverStoreMapSizeKb: {
|
|
32
|
+
env: 'ARCHIVER_STORE_MAP_SIZE_KB',
|
|
33
|
+
parseEnv: (val)=>val ? +val : undefined,
|
|
34
|
+
description: 'The maximum possible size of the archiver DB in KB. Overwrites the general dataStoreMapSizeKB.'
|
|
35
|
+
},
|
|
31
36
|
...chainConfigMappings,
|
|
32
37
|
...l1ReaderConfigMappings,
|
|
33
38
|
viemPollingIntervalMS: {
|
package/dest/archiver/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './archiver.js';
|
|
2
2
|
export * from './config.js';
|
|
3
3
|
export { type PublishedL2Block, type L1PublishedData } from './structs/published.js';
|
|
4
|
-
export { MemoryArchiverStore } from './memory_archiver_store/memory_archiver_store.js';
|
|
5
4
|
export type { ArchiverDataStore } from './archiver_store.js';
|
|
6
5
|
export { KVArchiverDataStore } from './kv_archiver_store/kv_archiver_store.js';
|
|
7
6
|
export { ContractInstanceStore } from './kv_archiver_store/contract_instance_store.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/archiver/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACrF,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/archiver/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACrF,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC"}
|
package/dest/archiver/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './archiver.js';
|
|
2
2
|
export * from './config.js';
|
|
3
|
-
export { MemoryArchiverStore } from './memory_archiver_store/memory_archiver_store.js';
|
|
4
3
|
export { KVArchiverDataStore } from './kv_archiver_store/kv_archiver_store.js';
|
|
5
4
|
export { ContractInstanceStore } from './kv_archiver_store/contract_instance_store.js';
|
|
@@ -67,8 +67,7 @@ import { Vector } from '@aztec/stdlib/types';
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
function serializeContractClassPublic(contractClass) {
|
|
70
|
-
return serializeToBuffer(contractClass.l2BlockNumber, numToUInt8(contractClass.version), contractClass.artifactHash, contractClass.
|
|
71
|
-
contractClass.publicFunctions?.map((f)=>serializeToBuffer(f.selector, f.bytecode.length, f.bytecode)) ?? [], contractClass.privateFunctions.length, contractClass.privateFunctions.map(serializePrivateFunction), contractClass.unconstrainedFunctions.length, contractClass.unconstrainedFunctions.map(serializeUnconstrainedFunction), contractClass.packedBytecode.length, contractClass.packedBytecode, contractClass.privateFunctionsRoot);
|
|
70
|
+
return serializeToBuffer(contractClass.l2BlockNumber, numToUInt8(contractClass.version), contractClass.artifactHash, contractClass.privateFunctions.length, contractClass.privateFunctions.map(serializePrivateFunction), contractClass.unconstrainedFunctions.length, contractClass.unconstrainedFunctions.map(serializeUnconstrainedFunction), contractClass.packedBytecode.length, contractClass.packedBytecode, contractClass.privateFunctionsRoot);
|
|
72
71
|
}
|
|
73
72
|
function serializePrivateFunction(fn) {
|
|
74
73
|
return serializeToBuffer(fn.selector, fn.vkHash, fn.bytecode.length, fn.bytecode, fn.functionMetadataHash, fn.artifactMetadataHash, fn.unconstrainedFunctionsArtifactTreeRoot, new Vector(fn.privateFunctionTreeSiblingPath), fn.privateFunctionTreeLeafIndex, new Vector(fn.artifactTreeSiblingPath), fn.artifactTreeLeafIndex);
|
|
@@ -82,12 +81,6 @@ function deserializeContractClassPublic(buffer) {
|
|
|
82
81
|
l2BlockNumber: reader.readNumber(),
|
|
83
82
|
version: reader.readUInt8(),
|
|
84
83
|
artifactHash: reader.readObject(Fr),
|
|
85
|
-
publicFunctions: reader.readVector({
|
|
86
|
-
fromBuffer: (reader)=>({
|
|
87
|
-
selector: reader.readObject(FunctionSelector),
|
|
88
|
-
bytecode: reader.readBuffer()
|
|
89
|
-
})
|
|
90
|
-
}),
|
|
91
84
|
privateFunctions: reader.readVector({
|
|
92
85
|
fromBuffer: deserializePrivateFunction
|
|
93
86
|
}),
|
|
@@ -2,7 +2,7 @@ import type { Fr } from '@aztec/foundation/fields';
|
|
|
2
2
|
import type { AztecAsyncKVStore, StoreSize } from '@aztec/kv-store';
|
|
3
3
|
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import type {
|
|
5
|
+
import type { L2Block } from '@aztec/stdlib/block';
|
|
6
6
|
import type { ContractClassPublic, ContractInstanceUpdateWithAddress, ContractInstanceWithAddress, ExecutablePrivateFunctionWithMembershipProof, UnconstrainedFunctionWithMembershipProof } from '@aztec/stdlib/contract';
|
|
7
7
|
import type { GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
|
|
8
8
|
import { type LogFilter, PrivateLog, type TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
@@ -20,7 +20,7 @@ export declare class KVArchiverDataStore implements ArchiverDataStore {
|
|
|
20
20
|
static readonly SCHEMA_VERSION = 1;
|
|
21
21
|
private functionNames;
|
|
22
22
|
constructor(db: AztecAsyncKVStore, logsMaxPageSize?: number);
|
|
23
|
-
|
|
23
|
+
getDebugFunctionName(_address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
24
24
|
registerContractFunctionSignatures(_address: AztecAddress, signatures: string[]): Promise<void>;
|
|
25
25
|
getContractClass(id: Fr): Promise<ContractClassPublic | undefined>;
|
|
26
26
|
getContractClassIds(): Promise<Fr[]>;
|
|
@@ -68,7 +68,7 @@ export declare class KVArchiverDataStore implements ArchiverDataStore {
|
|
|
68
68
|
* @param txHash - The txHash of the tx corresponding to the tx effect.
|
|
69
69
|
* @returns The requested tx effect (or undefined if not found).
|
|
70
70
|
*/
|
|
71
|
-
getTxEffect(txHash: TxHash): Promise<InBlock<import("@aztec/stdlib/tx").TxEffect> | undefined>;
|
|
71
|
+
getTxEffect(txHash: TxHash): Promise<import("@aztec/stdlib/block").InBlock<import("@aztec/stdlib/tx").TxEffect> | undefined>;
|
|
72
72
|
/**
|
|
73
73
|
* Gets a receipt of a settled tx.
|
|
74
74
|
* @param txHash - The hash of a tx we try to get the receipt for.
|
|
@@ -82,14 +82,6 @@ export declare class KVArchiverDataStore implements ArchiverDataStore {
|
|
|
82
82
|
*/
|
|
83
83
|
addLogs(blocks: L2Block[]): Promise<boolean>;
|
|
84
84
|
deleteLogs(blocks: L2Block[]): Promise<boolean>;
|
|
85
|
-
/**
|
|
86
|
-
* Append new nullifiers to the store's list.
|
|
87
|
-
* @param blocks - The blocks for which to add the nullifiers.
|
|
88
|
-
* @returns True if the operation is successful.
|
|
89
|
-
*/
|
|
90
|
-
addNullifiers(blocks: L2Block[]): Promise<boolean>;
|
|
91
|
-
deleteNullifiers(blocks: L2Block[]): Promise<boolean>;
|
|
92
|
-
findNullifiersIndexesWithBlock(blockNumber: number, nullifiers: Fr[]): Promise<(InBlock<bigint> | undefined)[]>;
|
|
93
85
|
getTotalL1ToL2MessageCount(): Promise<bigint>;
|
|
94
86
|
/**
|
|
95
87
|
* Append L1 to L2 messages to the store.
|
|
@@ -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,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAGnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
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,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAGnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EACV,mBAAmB,EACnB,iCAAiC,EACjC,2BAA2B,EAC3B,4CAA4C,EAC5C,wCAAwC,EACzC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC3G,OAAO,EAAE,KAAK,SAAS,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACp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anceStore } from './contract_instance_store.js';
|
|
7
7
|
import { LogStore } from './log_store.js';
|
|
8
8
|
import { MessageStore } from './message_store.js';
|
|
9
|
-
import { NullifierStore } from './nullifier_store.js';
|
|
10
9
|
/**
|
|
11
10
|
* LMDB implementation of the ArchiverDataStore interface.
|
|
12
11
|
*/ export class KVArchiverDataStore {
|
|
@@ -14,7 +13,6 @@ import { NullifierStore } from './nullifier_store.js';
|
|
|
14
13
|
static SCHEMA_VERSION = 1;
|
|
15
14
|
#blockStore;
|
|
16
15
|
#logStore;
|
|
17
|
-
#nullifierStore;
|
|
18
16
|
#messageStore;
|
|
19
17
|
#contractClassStore;
|
|
20
18
|
#contractInstanceStore;
|
|
@@ -29,12 +27,11 @@ import { NullifierStore } from './nullifier_store.js';
|
|
|
29
27
|
this.#messageStore = new MessageStore(db);
|
|
30
28
|
this.#contractClassStore = new ContractClassStore(db);
|
|
31
29
|
this.#contractInstanceStore = new ContractInstanceStore(db);
|
|
32
|
-
this.#nullifierStore = new NullifierStore(db);
|
|
33
30
|
}
|
|
34
31
|
// TODO: These function names are in memory only as they are for development/debugging. They require the full contract
|
|
35
32
|
// artifact supplied to the node out of band. This should be reviewed and potentially removed as part of
|
|
36
33
|
// the node api cleanup process.
|
|
37
|
-
|
|
34
|
+
getDebugFunctionName(_address, selector) {
|
|
38
35
|
return Promise.resolve(this.functionNames.get(selector.toString()));
|
|
39
36
|
}
|
|
40
37
|
async registerContractFunctionSignatures(_address, signatures) {
|
|
@@ -138,19 +135,6 @@ import { NullifierStore } from './nullifier_store.js';
|
|
|
138
135
|
deleteLogs(blocks) {
|
|
139
136
|
return this.#logStore.deleteLogs(blocks);
|
|
140
137
|
}
|
|
141
|
-
/**
|
|
142
|
-
* Append new nullifiers to the store's list.
|
|
143
|
-
* @param blocks - The blocks for which to add the nullifiers.
|
|
144
|
-
* @returns True if the operation is successful.
|
|
145
|
-
*/ addNullifiers(blocks) {
|
|
146
|
-
return this.#nullifierStore.addNullifiers(blocks);
|
|
147
|
-
}
|
|
148
|
-
deleteNullifiers(blocks) {
|
|
149
|
-
return this.#nullifierStore.deleteNullifiers(blocks);
|
|
150
|
-
}
|
|
151
|
-
findNullifiersIndexesWithBlock(blockNumber, nullifiers) {
|
|
152
|
-
return this.#nullifierStore.findNullifiersIndexesWithBlock(blockNumber, nullifiers);
|
|
153
|
-
}
|
|
154
138
|
getTotalL1ToL2MessageCount() {
|
|
155
139
|
return this.#messageStore.getTotalL1ToL2MessageCount();
|
|
156
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/kv_archiver_store/log_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAGnD,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC3G,OAAO,EAIL,KAAK,SAAS,EAEd,UAAU,EAEV,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,qBAAa,QAAQ;;IASP,OAAO,CAAC,EAAE;IAAqB,OAAO,CAAC,UAAU;gBAAzC,EAAE,EAAE,iBAAiB,EAAU,UAAU,EAAE,UAAU,EAAE,eAAe,GAAE,MAAa;IAwCzG;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAkE5C,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"log_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/kv_archiver_store/log_store.ts"],"names":[],"mappings":"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