Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions yarn-project/archiver/src/archiver/archiver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
import { Fr } from '@aztec/foundation/fields';
import { type Logger, createLogger } from '@aztec/foundation/log';
import { sleep } from '@aztec/foundation/sleep';
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
import { ForwarderAbi, type InboxAbi, RollupAbi } from '@aztec/l1-artifacts';
import { L2Block } from '@aztec/stdlib/block';
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
Expand All @@ -20,7 +21,7 @@ import { type Log, type Transaction, encodeFunctionData, toHex } from 'viem';
import { Archiver } from './archiver.js';
import type { ArchiverDataStore } from './archiver_store.js';
import type { ArchiverInstrumentation } from './instrumentation.js';
import { MemoryArchiverStore } from './memory_archiver_store/memory_archiver_store.js';
import { KVArchiverDataStore } from './kv_archiver_store/kv_archiver_store.js';

interface MockRollupContractRead {
/** Given an L2 block number, returns the archive. */
Expand Down Expand Up @@ -104,7 +105,7 @@ describe('Archiver', () => {

const tracer = getTelemetryClient().getTracer('');
instrumentation = mock<ArchiverInstrumentation>({ isEnabled: () => true, tracer });
archiverStore = new MemoryArchiverStore(1000);
archiverStore = new KVArchiverDataStore(await openTmpStore('archiver_test'), 1000);
l1Constants = {
l1GenesisTime: BigInt(now),
l1StartBlock: 0n,
Expand Down Expand Up @@ -361,7 +362,11 @@ describe('Archiver', () => {
const rollupTxs = await Promise.all(blocks.map(makeRollupTx));
const blobHashes = await Promise.all(blocks.map(makeVersionedBlobHashes));

publicClient.getBlockNumber.mockResolvedValueOnce(50n).mockResolvedValueOnce(100n).mockResolvedValueOnce(150n);
let mockedBlockNum = 0n;
publicClient.getBlockNumber.mockImplementation(() => {
mockedBlockNum += 50n;
return Promise.resolve(mockedBlockNum);
});

// We will return status at first to have an empty round, then as if we have 2 pending blocks, and finally
// Just a single pending block returning a "failure" for the expected pending block
Expand Down Expand Up @@ -402,7 +407,7 @@ describe('Archiver', () => {
expect(loggerSpy).toHaveBeenCalledWith(`No blocks to retrieve from 1 to 50`);

// Lets take a look to see if we can find re-org stuff!
await sleep(1000);
await sleep(2000);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, why the sleep bump?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was needed for it to pass. Guess the KvArchiveStore is slower.


expect(loggerSpy).toHaveBeenCalledWith(`L2 prune has been detected.`);

Expand Down
1 change: 0 additions & 1 deletion yarn-project/archiver/src/archiver/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from './archiver.js';
export * from './config.js';
export { type PublishedL2Block, type L1PublishedData } from './structs/published.js';
export { MemoryArchiverStore } from './memory_archiver_store/memory_archiver_store.js';
export type { ArchiverDataStore } from './archiver_store.js';
export { KVArchiverDataStore } from './kv_archiver_store/kv_archiver_store.js';
export { ContractInstanceStore } from './kv_archiver_store/contract_instance_store.js';
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export class LogStore {
this.#privateLogsByBlock.delete(block.number),
this.#publicLogsByBlock.delete(block.number),
this.#logTagsByBlock.delete(block.number),
this.#contractClassLogsByBlock.delete(block.number),
]),
),
);
Expand Down

This file was deleted.

Loading