Skip to content

fix(p2p): chunk archive of mined txs on block finalization (A-969)#23085

Merged
spalladino merged 2 commits into
merge-train/spartanfrom
phil/a-969-tx_pool_v2-potential-oom-processing-finalised-block
May 12, 2026
Merged

fix(p2p): chunk archive of mined txs on block finalization (A-969)#23085
spalladino merged 2 commits into
merge-train/spartanfrom
phil/a-969-tx_pool_v2-potential-oom-processing-finalised-block

Conversation

@PhilWindle
Copy link
Copy Markdown
Collaborator

@PhilWindle PhilWindle commented May 8, 2026

Summary

handleFinalizedBlock was 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

  • New unit test archives and deletes all mined txs across many chunks when finalizing a single block that finalizes 250 txs in a single call (above the 100-tx chunk size) and checks that all are archived and marked deleted.
  • All 239 existing tx_pool_v2.test.ts cases still pass.

PhilWindle added 2 commits May 8, 2026 11:17
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.
@PhilWindle PhilWindle marked this pull request as ready for review May 8, 2026 11:32
@spalladino spalladino merged commit b9f7b33 into merge-train/spartan May 12, 2026
25 checks passed
@spalladino spalladino deleted the phil/a-969-tx_pool_v2-potential-oom-processing-finalised-block branch May 12, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants