Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use messageHash as msgIdFn #1361

Closed
wants to merge 1 commit into from
Closed

feat: use messageHash as msgIdFn #1361

wants to merge 1 commit into from

Conversation

weboko
Copy link
Collaborator

@weboko weboko commented May 17, 2023

Problem

Relay node can send or receive duplicates of messages.

Solution

Update msgIdFn to use deterministic hashing.

Notes

* @param bytes Uint8Array
* @returns IProtoMessage
*/
export function fromBytesToProtoMessage(bytes: Uint8Array): IProtoMessage {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe should move it to @waku/utils/message 🤔

msgIdFn: ({ topic, data }) => {
try {
const protoMessage = message.fromBytesToProtoMessage(data);
return messageHash(topic, protoMessage);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Problem with this implementation is that in case meta is missing hash is taken based on this concat([pubsubTopicBytes, message.payload, contentTopicBytes])

It leads to inability of a user to send a message to the a pubSub/contentTopic in case someone already published a message with the same text.

Second problem of using messageHash as msgIdFn is that it won't be consistent with hashing in nwaku/go-waku as I mentioned here

@weboko
Copy link
Collaborator Author

weboko commented May 18, 2023

Closing for now.
Will get back to it when nodes will have it implemented.

@weboko weboko closed this May 18, 2023
@weboko weboko deleted the weboko/duplicate branch August 7, 2023 11:40
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.

bug: inconsistent messages on eth-pm
1 participant