Skip to content

Commit 5b456ca

Browse files
committed
Reverted unnecessary change
1 parent 1f80cb7 commit 5b456ca

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

yarn-project/p2p/src/mem_pools/tx_pool/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ Evicts low-priority transactions when a fee payer's pending fee limits exceed th
241241
Enforces maximum pool size by evicting lowest-priority (by fee) transactions:
242242

243243
- Configured via `maxPendingTxCount` option (0 = disabled)
244-
- Uses `getLowestPriorityPending()` to find txs to evict
244+
- Uses `getLowestPriorityEvictable()` to find txs to evict
245245

246246
### Non-Evictable Transactions
247247

yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ describe('KV TX pool', () => {
391391
await expect(txPool.getPendingTxHashes()).resolves.toEqual([tx5.getTxHash(), tx4.getTxHash(), tx1.getTxHash()]);
392392
});
393393

394-
describe('getLowestPriorityPending', () => {
394+
describe('getLowestPriorityEvictable', () => {
395395
it('returns the lowest-priority evictable tx hashes up to limit', async () => {
396396
txPool = new AztecKVTxPool(await openTmpStore('p2p'), await openTmpStore('archive'), worldState, undefined, {
397397
maxPendingTxCount: 0,
@@ -406,14 +406,14 @@ describe('KV TX pool', () => {
406406
// Mark tx2 as non-evictable; tx1 should be considered first
407407
await txPool.markTxsAsNonEvictable([tx2.getTxHash()]);
408408

409-
const res1 = await txPool.getLowestPriorityPending(1);
409+
const res1 = await txPool.getLowestPriorityEvictable(1);
410410
expect(res1).toEqual([tx1.getTxHash()]);
411411

412-
const res2 = await txPool.getLowestPriorityPending(2);
412+
const res2 = await txPool.getLowestPriorityEvictable(2);
413413
// After skipping non-evictable tx2, next lowest is tx3
414414
expect(res2).toEqual([tx1.getTxHash(), tx3.getTxHash()]);
415415

416-
const res3 = await txPool.getLowestPriorityPending(10);
416+
const res3 = await txPool.getLowestPriorityEvictable(10);
417417
expect(res3).toEqual([tx1.getTxHash(), tx3.getTxHash(), tx4.getTxHash()]);
418418
});
419419

@@ -422,10 +422,10 @@ describe('KV TX pool', () => {
422422
const tx1 = await mockTx(10, { maxPriorityFeesPerGas: new GasFees(1, 1) });
423423
await txPool.addTxs([tx1]);
424424

425-
expect(await txPool.getLowestPriorityPending(0)).toEqual([]);
425+
expect(await txPool.getLowestPriorityEvictable(0)).toEqual([]);
426426

427427
await txPool.markTxsAsNonEvictable([tx1.getTxHash()]);
428-
expect(await txPool.getLowestPriorityPending(1)).toEqual([]);
428+
expect(await txPool.getLowestPriorityEvictable(1)).toEqual([]);
429429
});
430430
});
431431

yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,10 +706,10 @@ export class AztecKVTxPool
706706
}
707707

708708
/**
709-
* Returns up to `limit` lowest-priority pending tx hashes without hydrating transactions.
709+
* Returns up to `limit` lowest-priority evictable pending tx hashes without hydrating transactions.
710710
* Iterates the priority index in ascending order and skips non-evictable txs.
711711
*/
712-
public async getLowestPriorityPending(limit: number): Promise<TxHash[]> {
712+
public async getLowestPriorityEvictable(limit: number): Promise<TxHash[]> {
713713
const txsToEvict: TxHash[] = [];
714714
if (limit <= 0) {
715715
return txsToEvict;

yarn-project/p2p/src/mem_pools/tx_pool/eviction/eviction_strategy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ export interface TxPoolOperations {
7474
/** Cheap count of current pending transactions. */
7575
getPendingTxCount(): Promise<number>;
7676
/**
77-
* Returns up to `limit` lowest-priority pending tx hashes.
77+
* Returns up to `limit` lowest-priority evictable pending tx hashes.
7878
* Ordering should be from lowest priority upwards.
7979
*/
80-
getLowestPriorityPending(limit: number): Promise<TxHash[]>;
80+
getLowestPriorityEvictable(limit: number): Promise<TxHash[]>;
8181
deleteTxs(txHashes: TxHash[], opts?: { permanently?: boolean }): Promise<void>;
8282
}
8383

yarn-project/p2p/src/mem_pools/tx_pool/eviction/low_priority_eviction_rule.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('LowPriorityEvictionRule', () => {
1515
txPool = mock();
1616
txPool.getPendingTxInfos.mockResolvedValue([]);
1717
txPool.getPendingTxCount.mockResolvedValue(0);
18-
txPool.getLowestPriorityPending.mockResolvedValue([]);
18+
txPool.getLowestPriorityEvictable.mockResolvedValue([]);
1919

2020
config = {
2121
maxPoolSize: 100,
@@ -126,7 +126,7 @@ describe('LowPriorityEvictionRule', () => {
126126
const tx2 = TxHash.random();
127127

128128
txPool.getPendingTxCount.mockResolvedValue(3);
129-
txPool.getLowestPriorityPending.mockResolvedValue([tx1, tx2]);
129+
txPool.getLowestPriorityEvictable.mockResolvedValue([tx1, tx2]);
130130

131131
const result = await rule.evict(context, txPool);
132132

@@ -145,7 +145,7 @@ describe('LowPriorityEvictionRule', () => {
145145
(context as any).newTxs = [newTx1, newTx2];
146146

147147
txPool.getPendingTxCount.mockResolvedValue(3);
148-
txPool.getLowestPriorityPending.mockResolvedValue([oldTx, newTx1]);
148+
txPool.getLowestPriorityEvictable.mockResolvedValue([oldTx, newTx1]);
149149

150150
const result = await rule.evict(context, txPool);
151151

@@ -156,7 +156,7 @@ describe('LowPriorityEvictionRule', () => {
156156

157157
it('handles all transactions being non-evictable', async () => {
158158
txPool.getPendingTxCount.mockResolvedValue(config.maxPoolSize + 1);
159-
txPool.getLowestPriorityPending.mockResolvedValue([]);
159+
txPool.getLowestPriorityEvictable.mockResolvedValue([]);
160160

161161
const result = await rule.evict(context, txPool);
162162

@@ -166,7 +166,7 @@ describe('LowPriorityEvictionRule', () => {
166166
txsEvicted: [],
167167
});
168168
expect(txPool.deleteTxs).not.toHaveBeenCalled();
169-
expect(txPool.getLowestPriorityPending).toHaveBeenCalledWith(1);
169+
expect(txPool.getLowestPriorityEvictable).toHaveBeenCalledWith(1);
170170
});
171171

172172
it('handles error from txPool operations', async () => {
@@ -187,7 +187,7 @@ describe('LowPriorityEvictionRule', () => {
187187
const t1 = TxHash.random();
188188
const t2 = TxHash.random();
189189
txPool.getPendingTxCount.mockResolvedValue(2);
190-
txPool.getLowestPriorityPending.mockResolvedValue([t1, t2]);
190+
txPool.getLowestPriorityEvictable.mockResolvedValue([t1, t2]);
191191
txPool.deleteTxs.mockRejectedValue(new Error('Test error'));
192192

193193
const result = await rule.evict(context, txPool);

yarn-project/p2p/src/mem_pools/tx_pool/eviction/low_priority_eviction_rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class LowPriorityEvictionRule implements EvictionRule {
5858

5959
this.log.verbose(`Evicting low priority txs. Pending tx count above limit: ${currentTxCount} > ${maxCount}`);
6060
const numberToEvict = currentTxCount - maxCount;
61-
const txsToEvict: TxHash[] = await txPool.getLowestPriorityPending(numberToEvict);
61+
const txsToEvict: TxHash[] = await txPool.getLowestPriorityEvictable(numberToEvict);
6262

6363
if (txsToEvict.length > 0) {
6464
await txPool.deleteTxs(txsToEvict);

0 commit comments

Comments
 (0)