Skip to content

Make messageIDs bytes instead of strings#285

Merged
vyzo merged 1 commit intolibp2p:masterfrom
rklaehn:master
Jul 25, 2020
Merged

Make messageIDs bytes instead of strings#285
vyzo merged 1 commit intolibp2p:masterfrom
rklaehn:master

Conversation

@rklaehn
Copy link
Contributor

@rklaehn rklaehn commented Jul 24, 2020

Rationale:

  • go-libp2p currently produces non-utf8 strings
  • making this bytes allows more flexibility in creating message ids, e.g.
    • random bytes
    • hashes

This issue was discovered in libp2p/rust-libp2p#1671 . There is a coresponding issue in go-ipfs-pubsub, libp2p/go-libp2p-pubsub#361

Changing this should have no negative impact. Implementations that expect valid utf-8 strings are already broken, because go-ipfs emits non utf8 strings. See libp2p/go-libp2p-pubsub#361 (comment)

Rationale:
- go-libp2p currently produces non-utf8 strings
- making this bytes allows more flexibility in creating message ids, e.g.
  - random bytes
  - hashes
rklaehn added a commit to rklaehn/go-libp2p-pubsub that referenced this pull request Jul 24, 2020
Copy link
Contributor

@vyzo vyzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do it!

@vyzo vyzo merged commit c5b328a into libp2p:master Jul 25, 2020
daviddias pushed a commit to libp2p/go-libp2p-pubsub that referenced this pull request Jul 27, 2020
Nashatyrev added a commit to libp2p/jvm-libp2p that referenced this pull request Nov 9, 2020
Nashatyrev added a commit to libp2p/jvm-libp2p that referenced this pull request Nov 9, 2020
Nashatyrev added a commit to libp2p/jvm-libp2p that referenced this pull request Nov 10, 2020
* Initial refactor: replace Rpc.Message with abstract PubsubMessage which is created by pluggable messageFactory.
messageFactory replaces messageIdGenerator because of PubsubMessage.messageId property
* Convert messageId from String to byte[] (see spec PR: libp2p/specs#285)
* Use WBytes ByteArray wrapper instead of plain ByteArray because of equals/hashCode absence
* Replace AbstractRouter.seenMessages with a special SeenCache interface which is capable of handling PubsubMessage.messageId in a lazy fashion
jxs pushed a commit to jxs/specs that referenced this pull request Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants