Skip to content

feat(network): add Zakura block sync#110

Closed
evan-forbes wants to merge 4 commits into
evan/zakura-04-service-discoveryfrom
evan/zakura-05-block-sync
Closed

feat(network): add Zakura block sync#110
evan-forbes wants to merge 4 commits into
evan/zakura-04-service-discoveryfrom
evan/zakura-05-block-sync

Conversation

@evan-forbes

Copy link
Copy Markdown

Motivation

Final stacked PR 5/5 of the Zakura networking layer. Builds on PR4. Adds Zakura block sync (download/verify/commit of block bodies over Zakura, coexisting with legacy sync), plus the security hardening, state/sync-flow refactor, and stabilization/throughput work that complete the feature.

Solution

Organized into four reviewable commits:

  1. feat(network): add Zakura block sync — block-sync wire + service scaffold, header v2 and body size hints, download reactor + scheduler, verify/commit/legacy coexistence, chain-tip reset handling, body serving/advertising, native-discovery integration, and the block-sync e2e + header-store bootstrap.
  2. fix(network): harden Zakura P2P against security audit findings — supervised-pipe abstraction and resolution of audit findings across transport, handshake, legacy gossip, discovery, header-sync, and block-sync (rate/alloc caps, per-IP caps, dial/task-lifetime supervision, malformed-prelude handling).
  3. refactor(network): rework Zakura block/header sync state flow — block/header sync state-management and commit-flow rework (adopts upstream's try_handoff_to_non_finalized_write checkpoint→non-finalized handoff).
  4. fix(network): stabilize Zakura block sync and tune throughput — final stabilization plus raising block-sync request size to 128 blocks and using the byte budget as the congestion window.

Tests

  • zebra-state (185 tests) and zebra-network suites pass locally.
  • cargo clippy --workspace --all-targets and cargo fmt --all -- --check clean locally with the CI feature set.
  • Zakura regtest e2e (cargo test -p zebrad --test zakura_regtest_e2e -- --ignored) exercises the full sync path.

Specifications & References

AI Disclosure

  • AI tools were used: Claude Code (Opus) for rebasing onto ironwood-main, resolving conflicts (notably the zebra-state handoff/pruned-storage merge), squashing 68 commits into these four, and this description.

PR Checklist

  • Conventional-commit title
  • Solution is tested
  • Changelog updated

Add the Zakura block-sync wire and service scaffold, header v2 and body
size hints, the download reactor and scheduler, verify/commit/legacy
coexistence, chain-tip reset handling and invalid-body scoring, body
serving/advertising, native-discovery integration, and the block-sync
e2e with legacy gate and header-store bootstrap.
Introduce the supervised-pipe abstraction and resolve the Zakura
security-audit findings across transport, handshake, legacy gossip,
discovery, header-sync, and block-sync (rate/alloc caps, per-IP caps,
dial/task-lifetime supervision, malformed-prelude handling, and more).
Rework the block- and header-sync state management and commit flow
(phase-0 state-management refactor and commit-state-flow refactor),
along with the sync fixes developed alongside it.
Final block-sync stabilization plus throughput tuning: raise the
block-sync request size to 128 blocks and make the byte budget the
block-sync congestion window.
@evan-forbes

Copy link
Copy Markdown
Author

Superseded by a 3-PR restructure: only commits at clean boundaries (C1/C5/C8) compile + pass clippy standalone, so the 5-way split was collapsed into #106 (P2P stack), #111 (discovery + header sync + block sync), and #112 (block-sync hardening/refactor/stabilization).

@evan-forbes
evan-forbes deleted the evan/zakura-05-block-sync branch June 17, 2026 11:58
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