diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/deleted_pool.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/deleted_pool.ts index e4eea8793967..9227e0b32809 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/deleted_pool.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/deleted_pool.ts @@ -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`); } } @@ -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; } @@ -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 }, ); } diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts index 7cd1b48a4a08..32a5db700677 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts @@ -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 { diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts index 593898ef9182..8c39393f48af 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts @@ -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', diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts index 7e4630e55269..f76c23eb7b1e 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts @@ -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', diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts index c9a015abe3ad..c9854aeb6a17 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts @@ -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', diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts index bc07801d8aaa..31979f3ea1a1 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts @@ -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 { @@ -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); @@ -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); @@ -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 { @@ -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, + }); } }