-
Notifications
You must be signed in to change notification settings - Fork 2
Labels
enhancementNew feature or requestNew feature or request
Description
Background
We need to update the SDS protocol to support more efficient message retrieval from Store nodes as per this update to the SDS specification: vacp2p/rfc-index#130
Problem
Currently, causal history entries only contain SDS message IDs. When a participant needs to retrieve missing messages based on causal dependencies, they have no way to efficiently query Store nodes since:
- Store nodes work with Waku message hashes, not SDS message IDs
- Time-based queries are inefficient and unreliable
- We lack a mapping between SDS message IDs and queryable identifiers
Proposed Solution
Update the causal history structure to include optional retrieval hints that can be used to efficiently query external stores:
message Message {
string message_id = 2;
string channel_id = 3;
optional int32 lamport_timestamp = 10;
repeated HistoryEntry causal_history = 11; // Updated structure
optional bytes bloom_filter = 12;
optional bytes content = 20;
}
message HistoryEntry {
string message_id = 1; // SDS message ID
optional bytes retrieval_hint = 2; // Optional hint for efficient retrieval (e.g., Waku message hash)
}Motivation
- Efficient Store Queries: Applications can provide Waku message hashes as retrieval hints for direct Store node queries
- Separation of Concerns: SDS message IDs remain independent of transport layer concerns
- Backward Compatibility: Optional field ensures existing implementations continue to work
Implementation Tasks
1. Update Protocol Definitions
- Update
message.nimto include newHistoryEntrytype - Modify
Messagestruct to useseq[HistoryEntry]instead ofseq[MessageID]forcausalHistory - Update protobuf serialization/deserialization in
protobuf.nim
2. Update Core Logic
- Modify
wrapOutgoingMessageto populate retrieval hints when creating causal history - Update dependency checking logic to work with new
HistoryEntrystructure
3. API Changes
- Update
markDependenciesMetto handle both message IDs and retrieval hints - Add new callback for applications to provide retrieval hints for historical messages
- Update callback signatures to use
seq[HistoryEntry]
4. Testing Requirements
- Update tests to cover both with/without retrieval hint scenarios
- Test causal dependency resolution with and without retrieval hints
- Verify protobuf serialization handles optional retrieval hints correctly
- Ensure bloom filter ACK mechanisms work with new structure
- Update libsds and sds-go bindings to work with new
HistoryEntrytype
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
In progress