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
7 changes: 5 additions & 2 deletions yarn-project/p2p/src/mem_pools/tx_pool_v2/deleted_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class DeletedPool {
}

if (count > 0) {
this.#log.debug(`Marked ${count} transactions from pruned blocks`);
this.#log.info(`Marked ${count} transactions from pruned blocks`);
}
}

Expand Down Expand Up @@ -237,7 +237,9 @@ export class DeletedPool {
await this.#txsDB.delete(txHash);
}

this.#log.debug(`Finalized ${toHardDelete.length} txs from pruned blocks at block ${finalizedBlockNumber}`);
this.#log.debug(`Finalized ${toHardDelete.length} txs from pruned blocks at block ${finalizedBlockNumber}`, {
txHashes: toHardDelete,
});
return toHardDelete;
}

Expand Down Expand Up @@ -269,6 +271,7 @@ export class DeletedPool {

this.#log.debug(
`Cleaned up ${toHardDelete.length} slot-deleted txs from slot ${previousSlot} (now slot ${currentSlot})`,
{ txHashes: toHardDelete },
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ export class FeePayerBalanceEvictionRule implements EvictionRule {

if (txsToEvict.length > 0) {
await pool.deleteTxs(txsToEvict);
this.log.verbose(`Evicted ${txsToEvict.length} txs due to insufficient fee payer balance`, {
txHashes: txsToEvict,
});
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class InvalidTxsAfterMiningRule implements EvictionRule {
await pool.deleteTxs(txsToEvict);
}

this.log.debug(`Evicted ${txsToEvict.length} invalid txs after block mined`);
this.log.debug(`Evicted ${txsToEvict.length} invalid txs after block mined`, { txHashes: txsToEvict });

return {
reason: 'block_mined_invalid_txs',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class InvalidTxsAfterReorgRule implements EvictionRule {
this.log.verbose(`Kept ${keptCount} txs that did not reference pruned blocks`);
}

this.log.debug(`Evicted ${txsToEvict.length} invalid txs after reorg`);
this.log.info(`Evicted ${txsToEvict.length} invalid txs after reorg`, { txHashes: txsToEvict });

return {
reason: 'reorg_invalid_txs',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export class LowPriorityEvictionRule implements EvictionRule {

const numNewTxsEvicted = context.newTxHashes.filter(newTxHash => txsToEvict.includes(newTxHash)).length;

this.log.verbose(`Evicted ${txsToEvict.length} low priority txs, including ${numNewTxsEvicted} newly added txs`);
this.log.verbose(`Evicted ${txsToEvict.length} low priority txs, including ${numNewTxsEvicted} newly added txs`, {
txHashes: txsToEvict,
});

return {
reason: 'low_priority',
Expand Down
18 changes: 14 additions & 4 deletions yarn-project/p2p/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export class TxPoolV2Impl {
await this.#txsDB.delete(txHashStr);
}
});
this.#log.info(`Deleted ${toDelete.length} invalid/rejected transactions on startup`);
this.#log.info(`Deleted ${toDelete.length} invalid/rejected transactions on startup`, { txHashes: toDelete });
}

async addPendingTxs(txs: Tx[], opts: { source?: string }): Promise<AddTxsResult> {
Expand Down Expand Up @@ -259,7 +259,10 @@ export class TxPoolV2Impl {
// Evict conflicts
for (const evictHashStr of preAddResult.txHashesToEvict) {
await this.#deleteTx(evictHashStr);
this.#log.debug(`Evicted tx ${evictHashStr} due to higher-fee tx ${txHashStr}`);
this.#log.debug(`Evicted tx ${evictHashStr} due to higher-fee tx ${txHashStr}`, {
evictedTxHash: evictHashStr,
replacementTxHash: txHashStr,
});
if (acceptedPending.has(evictHashStr)) {
// Evicted tx was from this batch - mark as ignored in result
acceptedPending.delete(evictHashStr);
Expand Down Expand Up @@ -471,6 +474,11 @@ export class TxPoolV2Impl {
// Step 7: Delete invalid and evicted txs
await this.#deleteTxsBatch([...invalid, ...toEvict]);

this.#log.info(
`Handled prune to block ${latestBlock.number}: ${valid.length} txs restored to pending, ${invalid.length} invalid, ${toEvict.length} evicted due to nullifier conflicts`,
{ txHashesRestored: valid.map(m => m.txHash), txHashesInvalid: invalid, txHashesEvicted: toEvict },
);

// Step 8: Run eviction rules for ALL pending txs (not just restored ones)
// This handles cases like existing pending txs with invalid fee payer balances
await this.#evictionManager.evictAfterChainPrune(latestBlock.number);
Expand All @@ -480,7 +488,7 @@ export class TxPoolV2Impl {
// Delete failed txs
await this.#deleteTxsBatch(txHashes.map(h => h.toString()));

this.#log.info(`Deleted ${txHashes.length} failed txs`);
this.#log.info(`Deleted ${txHashes.length} failed txs`, { txHashes: txHashes.map(h => h.toString()) });
}

async handleFinalizedBlock(block: BlockHeader): Promise<void> {
Expand Down Expand Up @@ -512,7 +520,9 @@ export class TxPoolV2Impl {
}

if (minedTxsToFinalize.length > 0) {
this.#log.info(`Finalized ${minedTxsToFinalize.length} mined txs from blocks up to ${blockNumber}`);
this.#log.info(`Finalized ${minedTxsToFinalize.length} mined txs from blocks up to ${blockNumber}`, {
txHashes: minedTxsToFinalize,
});
}
}

Expand Down
Loading