gossipsub API inconsistency between sub-unsub and topics
#5433
-
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yep this is intentional. Originally there was a complication where other implementations had no concept of using a "hash". There were issues with security originally and later it got adopted. The concept of a non-hash'd topic, is a user-friendly object that can abstract away the binary form of the topic. The input of a functions use this user-friendly type, however the internals of gossipsub only work with the hash'd versions. I.e once you submit a The Unfortunately I dont see a way around this, other than storing the pre-image of all the hashes we use along side the hash. But this seems more like a waste of memory for a slightly better user-experience, when the user themselves could also just build this mapping. |
Beta Was this translation helpful? Give feedback.
Yep this is intentional.
Originally there was a complication where other implementations had no concept of using a "hash". There were issues with security originally and later it got adopted. The concept of a non-hash'd topic, is a user-friendly object that can abstract away the binary form of the topic. The input of a functions use this user-friendly type, however the internals of gossipsub only work with the hash'd versions. I.e once you submit a
Topic
gossipsub then instantly converts it to aTopicHash
and stores that.The
behaviour::topics
function was a helper function that was later built to get access to what topics we are subscribed to. As the internals only know about the hashes …