Skip to content

cl, execution/execmodule: drive ForkChoiceUpdate per InsertBlocks batch#21525

Draft
sudeepdino008 wants to merge 1 commit into
mainfrom
sudeep/batched-fcu-during-backfill
Draft

cl, execution/execmodule: drive ForkChoiceUpdate per InsertBlocks batch#21525
sudeepdino008 wants to merge 1 commit into
mainfrom
sudeep/batched-fcu-during-backfill

Conversation

@sudeepdino008
Copy link
Copy Markdown
Member

@sudeepdino008 sudeepdino008 commented May 30, 2026

Problem

On a minimal/pruned node catching up after a gap, Caplin's persistent_block_collector.Flush inserts the entire backfill via InsertBlocks and only issues a single ForkChoiceUpdate at the very end. So the whole backfill (potentially 100k+ blocks for 2 weeks) lands in BlockTransaction before execution + prune can drain any of it.

Change

Drive a ForkChoiceUpdate after each completed InsertBlocks batch, so execution + prune run mid-flush and bound BlockTransaction growth instead of letting the full backfill accumulate first.

Effect (minimal mainnet node, ~100k-block gap)

metric before after
peak BlockTransaction ~4.6 GB ~726 MB (6.4× lower)
peak mdbx.dat ~19 GB ~9.2 GB

Tests

  • TestFlushDrivesFCUPerBatch, TestFlushSingleFCUWhenBelowBatchSize (collector)
  • TestInsertBlocksWithBatchedFCU, TestInsertBlocksWithBatchedFCU_BadBlockRecovery_{Foreground,Background} (execmodule)

Draft — full make lint + integration verification pending.

During a large Caplin backfill, persistent_block_collector.Flush inserts all
blocks via InsertBlocks and only issues a single ForkChoiceUpdate at the end,
so the entire backfill (100k+ blocks) piles into BlockTransaction before
execution and prune can drain it. Drive an FCU after each completed batch so
execution + prune run mid-flush, bounding BlockTransaction growth.
@sudeepdino008 sudeepdino008 force-pushed the sudeep/batched-fcu-during-backfill branch from ad9cf6a to 3fa8c81 Compare May 30, 2026 12:49
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.

1 participant