Skip to content

Skip post-warp-sync wait in parachain bootstrap#3246

Open
lrubasze wants to merge 4 commits intomainfrom
lrubasze/notify_warp_synced_finalized
Open

Skip post-warp-sync wait in parachain bootstrap#3246
lrubasze wants to merge 4 commits intomainfrom
lrubasze/notify_warp_synced_finalized

Conversation

@lrubasze
Copy link
Copy Markdown
Contributor

@lrubasze lrubasze commented May 7, 2026

Problem

After a relay-chain warp sync, the runtime_service places the warp-synced block directly as the outer finalized_block — it never enters the inner async_tree, so subscribers never receive Block/Finalized notifications for it. fetch_parachain_head_from_relay waits for the next Notification::Finalized, which only fires when the relay finalizes the block after the warp-synced one (~6–12 s).

Fix

Reshape the warp-sync MustSubscribe path so the warp-synced block flows through the normal OutputUpdate::BlockOutputUpdate::Finalized sequence:

  • Previous finalized block (pre_warp_finalized) becomes the tree's initial finalized state — a tree-level predecessor only, not the real chain parent.
  • Warp-synced block is inserted as a non-finalized child with its runtime pre-completed (no actual download), then input_finalize'd.
  • Subscribers receive pre_warp_finalized as initial finalized, then Block(warp_synced) + Finalized(warp_synced) on the channel back-to-back.

pre_warp_finalized is pruned the moment warp-synced is finalized; its placeholder runtime is Err(CodeNotFound).

This PR replaces #3210

@lrubasze lrubasze changed the title Lrubasze/notify warp synced finalized runtime_service: notify subscribers of warp-synced finalized block May 7, 2026
@lrubasze lrubasze requested review from bkchr, gab8i and skunert May 7, 2026 09:29
@lrubasze lrubasze changed the title runtime_service: notify subscribers of warp-synced finalized block Skip post-warp-sync wait in parachain bootstrap May 7, 2026
@lrubasze
Copy link
Copy Markdown
Contributor Author

lrubasze commented May 7, 2026

Benchmark results

Paseo + Asset Hub Paseo, time-to-finalized, n=10 iterations.

Mode Baseline main branch f4f2b69e (median / p95 / max) PR f361eab2 (median / p95 / max) Speedup (median / p95)
Cold 11.4s / 56.4s / 59.1s 5.5s / 9.8s / 12.3s 2.1× / 5.8×
Warm 17.8s / 91.0s / 92.9s 4.1s / 7.9s / 9.0s 4.3× / 11.5×

Highlights:

  • Warm variance collapses: σ 30.0s → 1.7s.
  • Cold variance: σ 18.2s → 2.2s; worst run 12.3s vs baseline 59.1s.
  • Baseline warm had 1/10 run fail to finalize; PR has 10/10.

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