Skip to content

Gap Sync: Skip Body Requests for Non-Archive Nodes#10752

Open
lrubasze wants to merge 31 commits intolrubasze/block-import-improvementsfrom
lrubasze/gap-sync-improvements
Open

Gap Sync: Skip Body Requests for Non-Archive Nodes#10752
lrubasze wants to merge 31 commits intolrubasze/block-import-improvementsfrom
lrubasze/gap-sync-improvements

Conversation

@lrubasze
Copy link
Contributor

@lrubasze lrubasze commented Jan 8, 2026

Summary

This PR optimizes gap sync bandwidth usage by skipping body requests for non-archive nodes. Bodies are unnecessary during gap sync when the node doesn't maintain full block history, while archive nodes continue to request bodies to preserve complete history.
It reduces bandwidth consumption and database size significantly for typical validator/full nodes.

Additionally added some gap sync statistics for observability:

  • Introduced GapSyncStats to track bandwidth usage: header bytes, body bytes, justification bytes
  • Logged on gap sync completion to provide visibility into bandwidth savings

@lrubasze lrubasze added the T0-node This PR/Issue is related to the topic “node”. label Jan 8, 2026
@lrubasze
Copy link
Contributor Author

lrubasze commented Jan 9, 2026

/cmd prdoc --audience node_dev --audience node_operator --bump patch --force

…e_dev --audience node_operator --bump patch --force'
@lrubasze lrubasze changed the base branch from lrubasze/block-import-improvements to master January 9, 2026 07:36
@lrubasze lrubasze changed the base branch from master to lrubasze/block-import-improvements January 9, 2026 07:36
@lrubasze lrubasze requested review from bkchr and skunert January 9, 2026 07:37
Copy link
Contributor

@skunert skunert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall logic looks quite good. Ome thing you can do is make this behaviour a bit more explicit by adding a node to the warp sync CLI. Just a quick mention so that users can know what state the node will be in when warp sync is finished.

@bkontur
Copy link
Contributor

bkontur commented Jan 12, 2026

cc: @karolk91 maybe it looks like something related what we discussed the last week?

@lrubasze
Copy link
Contributor Author

/cmd prdoc --audience node_dev --audience node_operator --bump patch --force

…e_dev --audience node_operator --bump patch --force'
@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/20956214511
Failed job name: test-linux-stable-int

Copy link
Contributor

@iulianbarbu iulianbarbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@karolk91
Copy link
Contributor

karolk91 commented Jan 15, 2026

cc: @karolk91 maybe it looks like something related what we discussed the last week?

looks related indeed, @lrubasze can we hold a bit with merge of this ? I will be soon exploring how warp syncing related to bulletin parachain works..

but my current understanding is that this is a case when we have block pruning set but still need BODY of the blocks during gap sync -- for sure we don't need the full history of blocks with BODY-ies, just the last X blocks defined by the retention period of the chain

also possible that I'm mixing here the concept of relay chain warp syncing and parachain warp syncing

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some last nits.

@lrubasze
Copy link
Contributor Author

lrubasze commented Feb 5, 2026

/cmd fmt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T0-node This PR/Issue is related to the topic “node”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants