fix(p2p): chunk archive of mined txs on block finalization (A-969)#23085
Merged
spalladino merged 2 commits intoMay 12, 2026
Conversation
handleFinalizedBlock previously hydrated every mined-finalized tx into a single in-memory array before archiving and deleting them. At 10 TPS that is ~23k full Tx objects per epoch, which OOMs the node. Process the mined txs in chunks of 100: hydrate a chunk, archive it, hard- delete it, then move on. Peak memory is bounded regardless of epoch size.
Skip chunking entirely when archiving is disabled — there is no need to hydrate Tx objects to delete them. When archiving is enabled, hydrate + archive in chunks of 100, then run a single transaction that deletes the mined txs and finalizes the deleted pool.
spalladino
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
handleFinalizedBlockwas hydrating every mined-finalized tx into a single in-memory array before archiving and deleting them.This change processes the mined txs in chunks of 100. Peak memory is bounded regardless of epoch size. The deleted-pool finalize step runs once at the end after all chunks are processed.
Fixes A-969.
Test plan
archives and deletes all mined txs across many chunks when finalizing a single blockthat finalizes 250 txs in a single call (above the 100-tx chunk size) and checks that all are archived and marked deleted.tx_pool_v2.test.tscases still pass.