From bc1b1ed6ae757b74fea93dacfcc7b56f021bf7cb Mon Sep 17 00:00:00 2001 From: Sukhman Singh <63765293+sukhman-sukh@users.noreply.github.com> Date: Sun, 24 Aug 2025 23:41:36 +0530 Subject: [PATCH] fix_gossipsub_mid_type (#859) * fix_gossipsub_mid_type * Fix lint and add newsfragments * Fix mid formation * Revert "Fix mid formation" This reverts commit 835d4ca7af58f0716db51a00a8a7aa6cc15ac0a6. --- libp2p/pubsub/gossipsub.py | 8 ++++---- newsfragments/859.feature.rst | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 newsfragments/859.feature.rst diff --git a/libp2p/pubsub/gossipsub.py b/libp2p/pubsub/gossipsub.py index cebc438b..c345c138 100644 --- a/libp2p/pubsub/gossipsub.py +++ b/libp2p/pubsub/gossipsub.py @@ -775,16 +775,16 @@ class GossipSub(IPubsubRouter, Service): # Get list of all seen (seqnos, from) from the (seqno, from) tuples in # seen_messages cache seen_seqnos_and_peers = [ - seqno_and_from for seqno_and_from in self.pubsub.seen_messages.cache.keys() + str(seqno_and_from) + for seqno_and_from in self.pubsub.seen_messages.cache.keys() ] # Add all unknown message ids (ids that appear in ihave_msg but not in # seen_seqnos) to list of messages we want to request - # FIXME: Update type of message ID - msg_ids_wanted: list[Any] = [ + msg_ids_wanted: list[str] = [ msg_id for msg_id in ihave_msg.messageIDs - if literal_eval(msg_id) not in seen_seqnos_and_peers + if msg_id not in seen_seqnos_and_peers ] # Request messages with IWANT message diff --git a/newsfragments/859.feature.rst b/newsfragments/859.feature.rst new file mode 100644 index 00000000..7307c82f --- /dev/null +++ b/newsfragments/859.feature.rst @@ -0,0 +1 @@ +Fix type for gossipsub_message_id for consistency and security