-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix: topicToKey should return a buffer not a string #16
Conversation
Also, `Buffer.toString()` can result in unprintable characters being part of the string which can result in false positives when comparing stringified buffers. Also, also, stop putting stringified buffers into the logs because it can corrupt your console output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Can you just test this commit version with ipfs/interop tests before I release this?
Interesting, does the go implementation stringify buffers and use them for comparison? There have been bugs with this previously where it used the default ASCII encoding for byte arrays sent in HTTP responses which meant you then couldn't recreate them on the client side as it generated invalid JSON. |
Yes, that was a problem at the time I implemented this. The topics needed to be in this exact format to be consistent with the go side |
Hmm, this sounds like a bug in the go implementation. We shouldn't replicate their bugs 🤣 |
Yes, except when we also need to interop with them! I would like a venue to have these discussions |
The interop tests with this pass for me locally. Need ipfs/js-ipfs#2428 to go in before it'll pass on CI though as it's got some fixes for other failing interop tests. |
Cool! So, should I move and release this? |
Yes please! |
Also,
Buffer.toString()
without specifying an encoding can result in unprintable characters being part of the string which can result in false positives when comparing stringified buffers.E.g:
Also, also, stop putting stringified buffers into the logs because it can corrupt your console output.