Skip to content

feat(network): improve state sync peer registration and tracking#11451

Open
muXxer wants to merge 4 commits intodevelopfrom
feat/node-improve-network-layer
Open

feat(network): improve state sync peer registration and tracking#11451
muXxer wants to merge 4 commits intodevelopfrom
feat/node-improve-network-layer

Conversation

@muXxer
Copy link
Copy Markdown
Contributor

@muXxer muXxer commented May 6, 2026

Description of change

  • Adds a StateSyncHandshake protocol — on connect, both sides immediately exchange chain identity (genesis checkpoint), sync height, and pruning watermark. This eliminates a race condition where push_checkpoint_summary could arrive before the peer was registered (the old flow required multiple sequential queries).
  • Fixes PeerHeights insertion — new peers are now registered with complete info (chain identity + height + lowest watermark) in a single step, and the lowest field is correctly updated on reconnect.
  • Filters disconnected peers in PeerBalancer — peers that disappeared between balancer construction and iteration are skipped, avoiding wasted requests. The RTT selection window is also widened (2 → 10).
  • Periodic PeerHeights cleanup during sync — temp maps are pruned every 10k checkpoints to prevent unbounded memory growth during long syncs.
  • Removes the legacy get_checkpoint_summary(Latest) fallback in query_peer_for_latest_info.
  • Improves error context — failed checkpoint sync now reports connected/known peer counts.

Links to any relevant issues

fixes #11440
fixes #11441

How the change has been tested

  • Basic tests (linting, compilation, formatting, unit/integration tests)
  • Patch-specific tests (correctness, functionality coverage)
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

Release Notes

  • Protocol:
  • Nodes (Validators and Full nodes): Hardened state sync peer tracking:
    • added a handshake protocol to eliminate race conditions during peer registration
    • fixed stale peer handling
    • added periodic cleanup to prevent memory growth during long syncs
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • gRPC:

@muXxer muXxer requested a review from a team as a code owner May 6, 2026 20:22
@iota-ci iota-ci added core-protocol node Issues related to the Core Node team labels May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-protocol node Issues related to the Core Node team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node: add endpoint to query a node for the chain_id node: remove old style query from query_peer_for_latest_info

3 participants