mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-14 22:13:09 +00:00
* fix!: avoid SDS lamport timestamp overflow The SDS timestamp is initialized to the current time in milliseconds, which is a 13 digits value (e.g. 1,759,223,090,052). The maximum value for int32 is 2,147,483,647 (10 digits), which is clearly less than the timestamp. Maximum value for uint32 is 4,294,967,295 (10 digits), which does not help with ms timestamp. uint64 is BigInt in JavaScript, so best to be avoided unless strictly necessary as it creates complexity. max uint64 is 18,446,744,073,709,551,615 (20 digits). Using seconds instead of milliseconds would enable usage of uint32 valid until the year 2106. The lamport timestamp is only initialized to current time for a new channel. The only scenario is when a user comes in a channel, and thinks it's new (did not get previous messages), and then starts sending messages. Meaning that there may be an initial timestamp conflict until the logs are consolidated, which is already handled by the protocol. * change lamportTimestamp to uint64 in protobuf * lamport timestamp remains close to current time
17 lines
1016 B
Protocol Buffer
17 lines
1016 B
Protocol Buffer
syntax = "proto3";
|
|
|
|
message HistoryEntry {
|
|
string message_id = 1; // Unique identifier of the SDS message, as defined in `Message`
|
|
optional bytes retrieval_hint = 2; // Optional information to help remote parties retrieve this SDS message; For example, A Waku deterministic message hash or routing payload hash
|
|
}
|
|
|
|
message SdsMessage {
|
|
string sender_id = 1; // Participant ID of the message sender
|
|
string message_id = 2; // Unique identifier of the message
|
|
string channel_id = 3; // Identifier of the channel to which the message belongs
|
|
optional uint64 lamport_timestamp = 10; // Logical timestamp for causal ordering in channel
|
|
repeated HistoryEntry causal_history = 11; // List of preceding message IDs that this message causally depends on. Generally 2 or 3 message IDs are included.
|
|
optional bytes bloom_filter = 12; // Bloom filter representing received message IDs in channel
|
|
optional bytes content = 20; // Actual content of the message
|
|
}
|