Skip to content

Migrate client SyncRequest to heads-based sync protocol #43

@intendednull

Description

@intendednull

Problem

The client-side SyncRequest handler in crates/client/src/listeners.rs uses the legacy state_hash field which is meaningless in the DAG model. It currently sends the first 500 events from topological sort regardless of the requester's state, causing redundant data transfer.

The worker-side sync protocol already uses HeadsSummary-based delta sync (WorkerRequest::Sync { heads }), which is much more efficient.

Suggested fix

Migrate the client's sync protocol to use HeadsSummary advertising (same as workers):

  1. Replace WireMessage::SyncRequest { state_hash } with a heads-based variant
  2. Use EventDag::events_since() to compute deltas
  3. Remove the legacy state_hash field from the wire protocol

Location

crates/client/src/listeners.rs:230-248

Found during audit of #26.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions