xmtp / proto

Shared Protocol Buffers and their associated generated code
MIT License
17 stars 5 forks source link

Split sid into two fields, use map for vector clock #206

Closed richardhuaaa closed 1 month ago

richardhuaaa commented 1 month ago

It's slowly becoming more apparent that the sid concept isn't very useful compared to having separate node_id and sequence_id fields:

  1. We've removed gateway sequence ID's, so there's much less potential for confusion between local and remote sequence ID's
  2. We're using a separate uint32 node ID field in various places already, including target_originator, publisher_node_id and inside EnvelopesQuery
  3. Updating and manipulating vector clocks are now a lot more important on both server and client, and using a map<node_id, sequence_id> type is more ergonomic compared to a list of sids.

Protobufs use a varint under the hood, so there shouldn't be much size difference, exactly as @neekolas pointed out originally. This should also make the spec easier to understand and explain, and gives us more bits to work with for both node ID's and sequence ID's.

One con:

github-actions[bot] commented 1 month ago

:tada: This PR is included in version 3.69.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: