Skip to content

Commit

Permalink
test: attestation pool pruning
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 committed Nov 30, 2024
1 parent 67ea59c commit b95bcef
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion yarn-project/p2p/src/client/p2p_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,5 +327,20 @@ describe('In-Memory P2P Client', () => {
});
});

// TODO(https://github.com/AztecProtocol/aztec-packages/issues/7971): tests for attestation pool pruning
describe('Attestation pool pruning', () => {
it('deletes attestations older than the number of slots we want to keep in the pool', async () => {
const advanceToProvenBlockNumber = 20;
const keepAttestationsInPoolFor = 12;

blockSource.setProvenBlockNumber(0);
(client as any).keepAttestationsInPoolFor = keepAttestationsInPoolFor;
await client.start();
expect(attestationPool.deleteAttestationsOlderThan).not.toHaveBeenCalled();

await advanceToProvenBlock(advanceToProvenBlockNumber);

expect(attestationPool.deleteAttestationsOlderThan).toHaveBeenCalledTimes(1);
expect(attestationPool.deleteAttestationsOlderThan).toHaveBeenCalledWith(BigInt(advanceToProvenBlockNumber - keepAttestationsInPoolFor));
});
});
});

0 comments on commit b95bcef

Please sign in to comment.