Context
The replay node (crates/replay/src/role.rs) currently uses a flat VecDeque<Event> FIFO buffer with apply_lenient(). It needs to be rewritten for the per-author DAG model.
What needs to change
ServerData struct
// Old
struct ServerData {
state: ServerState,
events: VecDeque<Event>, // bounded FIFO
}
// New
struct ServerData {
dag: EventDag,
state: ServerState, // cached, maintained incrementally
pending: PendingBuffer,
max_events_per_author: usize,
}
Key changes
- Per-author bounded chains instead of single FIFO (prevents chatty peer from evicting quiet peer's history)
- Sync via
HeadsSummary comparison instead of StateHash linear scan
on_event() uses dag.insert() + apply_incremental() + pending.resolve()
- Snapshot fallback when peer is too far behind
- Handle
InsertError variants (SeqGap → buffer, Duplicate → skip)
Depends on
- Wire protocol update (WorkerRequest/WorkerResponse changes)
References
- Spec:
docs/specs/2026-04-01-per-author-merkle-dag-state-design.md (Section 8)
Context
The replay node (
crates/replay/src/role.rs) currently uses a flatVecDeque<Event>FIFO buffer withapply_lenient(). It needs to be rewritten for the per-author DAG model.What needs to change
ServerData struct
Key changes
HeadsSummarycomparison instead ofStateHashlinear scanon_event()usesdag.insert()+apply_incremental()+pending.resolve()InsertErrorvariants (SeqGap → buffer, Duplicate → skip)Depends on
References
docs/specs/2026-04-01-per-author-merkle-dag-state-design.md(Section 8)