Skip to content

Commit 518c836

Browse files
spalladinoclaude
andcommitted
refactor(p2p): remove InMemoryAttestationPool, use KvAttestationPool everywhere
- Delete memory_attestation_pool.ts and memory_attestation_pool.test.ts - Add createTestAttestationPool() factory function for test setup - Update p2p_client.test.ts to use createTestAttestationPool() - Update index.ts exports to export KvAttestationPool instead of InMemoryAttestationPool The InMemoryAttestationPool in test-helpers/testbench-utils.ts is kept as a minimal mock for benchmarking purposes. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 802f7f5 commit 518c836

File tree

5 files changed

+11
-323
lines changed

5 files changed

+11
-323
lines changed

yarn-project/p2p/src/client/p2p_client.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ import { expect, jest } from '@jest/globals';
2424
import { type MockProxy, mock } from 'jest-mock-extended';
2525

2626
import type { P2PConfig } from '../config.js';
27-
import { InMemoryAttestationPool, type P2PService } from '../index.js';
27+
import type { P2PService } from '../index.js';
2828
import type { AttestationPool } from '../mem_pools/attestation_pool/attestation_pool.js';
29+
import { createTestAttestationPool } from '../mem_pools/attestation_pool/kv_attestation_pool.js';
2930
import type { MemPools } from '../mem_pools/interface.js';
3031
import { AztecKVTxPool } from '../mem_pools/tx_pool/aztec_kv_tx_pool.js';
3132
import type { TxPool } from '../mem_pools/tx_pool/index.js';
@@ -60,7 +61,7 @@ describe('P2P Client', () => {
6061
txCollection = mock<TxCollection>();
6162
txCollection.getConstants.mockReturnValue(l1Constants);
6263

63-
attestationPool = new InMemoryAttestationPool();
64+
attestationPool = await createTestAttestationPool();
6465

6566
blockSource = new MockL2BlockSource();
6667
await blockSource.createBlocks(100);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export * from './attestation_pool.js';
2-
export * from './memory_attestation_pool.js';
2+
export * from './kv_attestation_pool.js';

yarn-project/p2p/src/mem_pools/attestation_pool/kv_attestation_pool.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,10 @@ export class KvAttestationPool implements AttestationPool {
374374
return count;
375375
}
376376
}
377+
378+
/** Creates a KvAttestationPool backed by a temporary store for testing. */
379+
export async function createTestAttestationPool(telemetry?: TelemetryClient): Promise<KvAttestationPool> {
380+
const { openTmpStore } = await import('@aztec/kv-store/lmdb-v2');
381+
const store = await openTmpStore('test-attestation-pool');
382+
return new KvAttestationPool(store, telemetry);
383+
}

yarn-project/p2p/src/mem_pools/attestation_pool/memory_attestation_pool.test.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

yarn-project/p2p/src/mem_pools/attestation_pool/memory_attestation_pool.ts

Lines changed: 0 additions & 309 deletions
This file was deleted.

0 commit comments

Comments
 (0)